aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorIngmar Steen <iksteen@gmail.com>2026-09-06 20:34:26 +0200
committerIngmar Steen <iksteen@gmail.com>2026-09-06 20:34:26 +0200
commit79a2812808061129bf1449d9f4c3356b36bf0061 (patch)
tree773ca521e7432af6e271bfb7f69ff2ab5047f1c9 /include
parentgraphics: place what a float leaves of an image, not nothing (diff)
downloadslosh-79a2812808061129bf1449d9f4c3356b36bf0061.tar.gz
slosh-79a2812808061129bf1449d9f4c3356b36bf0061.tar.xz
slosh-79a2812808061129bf1449d9f4c3356b36bf0061.zip
app: cut the modals, toasts and splash out of the images under them
Overlays are painted over the panes and the compositor needs no more than that: painted later is on top. A placement is not painted, though -- the client's terminal draws the image over the cells, in whatever order they arrived -- so an overlay that is only drawn is an overlay an image sits on top of. The cheatsheet came up under a picture and was unreadable through it, in the terminal and in the mirror both. So a frame now records where its overlays landed, and the graphics pass takes them out of a placement exactly as it takes out a float: the modal's box (the cheatsheet and the picker wear the same frame), each toast, and the splash. The list is rebuilt every compose, so a rect that is not registered again is one that is no longer on screen. Only the opaque things are registered. The scrim behind a modal tints what is behind it rather than hiding it, and an image cannot be tinted by us at all -- so a picture beside the cheatsheet stays bright while the text around it is pushed back, which is wrong-looking but a great deal better than the image disappearing while a modal is up. 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/app_internal.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/app_internal.h b/include/app_internal.h
index 38a1a6d..af59b6f 100644
--- a/include/app_internal.h
+++ b/include/app_internal.h
@@ -10,6 +10,10 @@
#include "expr.h"
#include "shader.h"
+/* How many overlays one frame can have cut out of its images: the modal box
+ * (one at a time), three toasts, the splash, and room to spare. */
+#define APP_MAX_OVERLAYS 8
+
/* A chain attached to one pane, with the programs its expressions compiled to
* kept beside it. Together because they are one lifetime: freeing the chain
* without the programs leaks, and freeing the programs without the chain leaves
@@ -229,6 +233,16 @@ struct app {
} toasts[3];
size_t ntoasts;
+ /* Where this frame's overlays landed: a modal's box, a toast, the splash.
+ * The compositor needs no such list -- painted later is on top -- but an
+ * image is not painted, it is placed, and the client's terminal draws it
+ * over the cells whatever order they arrived in. So the graphics pass cuts
+ * the overlays out of a placement the way it cuts out a float, and this is
+ * how it learns where they were. Rebuilt every compose; a rect that is not
+ * re-registered is one that is no longer on screen. */
+ rect_t overlays[APP_MAX_OVERLAYS];
+ size_t noverlays;
+
/* What a selection put on the clipboard, kept for middle-click paste (the
* X11 primary-selection habit) and handed to the client as OSC 52. */
char *clipboard;
@@ -444,6 +458,8 @@ void rename_begin(app_t *a, uint32_t id);
void rename_tab_begin(app_t *a, uint32_t id);
void draw_splash(app_t *a, screen_t *s);
+/* Say that a rect was painted over the panes this frame; see `overlays`. */
+void app_overlay(app_t *a, rect_t r);
/* round two */
void drop_pane_on_strip(app_t *a);