Commit graph imsd-messages/interfaces/ImsdMessages.Ui-App.cppm
Author SHA1 Message Date
99119e6d5e
Ui: log the Vulkan device and descriptor mode
One line at the first window names the device, whether descriptors go
through the heap or through sets, and the window's scale — the phone's
answer to "which path ran".
2026-11-18 01:12:27 +01:00
20e687452f
Ui, main: the new-conversation screen and the long-press sheets
The + opens a screen with a number field (its placeholder "Number", a
parameter of the compose field now) and Start; the number becomes a
conversation key through Number's ConversationKey, as an sms: link's
does (E.164 through the country code, a short code as digits), anything
else is refused in place. A long press on a conversation row offers to
delete the conversation, on a message to copy its text to the clipboard
or delete it; only those two have one: App tells the recogniser before
each press whether what it lands on has a long press (GestureDetector's
longPress), and without one a press held as long — on a button, a field,
a sheet's row — stays a tap at its release, so a slow finger presses the
button all the same. A sheet draws on the overlay layer over a scrim and
pushes its regions last, so they win the hit test, and the wheel scrolls
nothing under it; Escape, the back arrow and a tap outside dismiss it.
Deleting a conversation also closes its notification and drops its
draft; the + keeps the draft of the conversation it leaves, as Back
does, and so does a view that closes because its last message was
deleted. The deletes go through Sync (Erase, EraseConversation: the
commit before, which keeps a deleted text deleted). The number field's
box is drawn by its screen, as the send bar's is by the bar: the shared
field drawing paints no background of its own. Opening a conversation,
from a notification or a link, leaves the new-conversation screen and
any sheet, and the + leaves any sheet. A key whose press changed the
screen acts once: held, its repeats are not the new screen's — Enter,
which started the conversation, would type line breaks into its field,
and Escape would go on back, from a sheet through the conversation and
its draft. A sheet that asks to delete a conversation goes when a text
arrives for it: a yes would delete that text unread. A press on the
conversation's row opens no such sheet either while the row it aimed at
had not shown the text — the regions are a frame's: the press that is
down when the text arrives, and one that comes down before the next
frame is drawn, have no long press; a release before the long-press time
is still the row's tap, while the row stays under the finger.

--new and --bench-sheet put either on screen for the bench
(--bench-sheet conversation or message, each on the screen a long press
opens it over: another value is refused, and one that finds nothing to
press says so in the log), and are window flags as --screenshot is.

Tested: the screens and the sheets by the bench (--new, --bench-sheet)
and the phone step's screenshots; the deletes' logic with the commit
before, in tests/Store and tests/Sync; the press without a long press in
tests/Gesture (the timer gives no long press and a move within the slop
nothing; the release is the tap, however late; a slide off the control
is a drag); a deleted conversation's draft dropped, in tests/Edit. The
press on a row a text arrived for has no bench: none holds a finger on a
row.
2026-11-18 01:12:27 +01:00
07c6c3e5bd
Ui, main: closing the window hides it; Activate shows it again
The resident model: a close tears the window down — a fling stops, the
device finishes its frame, the listeners let go, the frame driver and
the canvas go — and keeps the process, the store, the screens and the
bus subscription. Show builds the window again, with a conversation left
open coming back (its caret blinking again; an Open or a Show that lands
between a close and its deferred teardown keeps the window); the Wayland
display source is kept across a hide. A text that arrives for the kept
conversation while the window is hidden — from the close on, not from
its deferred teardown — stays unread and keeps its notification, like
any other conversation's; showing the window again marks it read and
closes the notification. Without a session bus, where nothing could show
the window again, a close ends the process as before. A second launch
reaches the running instance over the bus name and a notification's tap
through its ActionInvoked signal, as before.

--hide-after and --hide-every drive the cycle from the bench as closes
(without a session bus such a close ends the process, as any close does
there), and are window flags as --screenshot is.
2026-11-18 01:12:27 +01:00
8a03a4ed49
main, utilities: bench helpers and a fake imsd
--prefill types into the opened conversation's field (App::Prefill, the
bench's typing, comes with it), --send-draft taps Send 1.5 s after start
and --screenshot-after chooses the moment of the capture, so a machine
can exercise the compose path and look at the result; --prefill and
--send-draft are window flags as --screenshot is — refused beside --send
and --quit, and beside a running instance (--screenshot-after acts
through --screenshot, refused there, its seconds checked as
--quit-after's are) — and a --prefill text that is not UTF-8 is refused
as --send's is. utilities/fake-imsd.py owns net.catcrafts.IMS1 on the
session bus with the answers chosen on its command line: a registered
daemon (its GetStatus answers name the subscriber's number, --ppi; the
Messaging one and every text the SIM's operator, --operator) that
accepts sends and reports them sent (the stamp in imsd's ISO 8601 form,
at the host's offset) and delivered, a store to list and delete, texts
injected at start or delivered as unicast Received while the app runs,
the refusals (AccessDenied, NotSupported, failed sends) and a Subscribe
answered late (--subscribe-delay: the app before imsd's status is in).
It runs on the host (python3-gi), the app in the sandbox, both on the
same session bus.
2026-11-18 01:12:27 +01:00
efd8dd92d3
Ui: the compose field and the send bar
A text message needs several lines and UTF-8, and the library's
InputField is one line edited by byte, so the field is the app's own.
Its state and editing are the core's (ImsdMessages:Edit, tested without
a window): a plain struct, insertion at the cursor, Backspace and Delete
by code point, Home and End within the line, a newline. Ui:Compose turns
the keys into those edits and draws the field one to five lines tall —
as many as half the area under the header and the banner holds, and one
at the least — with the canvas's word wrapper (a longer text shows the
lines that end at the caret's, or the first ones while the caret is
among them), a placeholder when empty, the caret at the cursor, and a
tap placing the cursor at the nearest byte by the widths the glyphs are
drawn at, in the text as it is when the tap lands (an edit since the
last frame only asked for one; a field no frame has laid out yet takes a
tap as one at its text's end; a tap at or past the last line's end asks
for the text's end, where a space the wrapper hung off the line may be).
The bar under a conversation holds the field and Send, enabled only with
text, a sendable status and an address to send to; Send hands the text
to Sync with that address and clears the field (a store that refuses the
text keeps the draft) (Model's SendAddress: as a link gave it, else the
latest message's — the network's form of a received text, the dialled
form of ours — never the key, whose completed country code is a guess
that groups; a conversation with neither has Send off, and so has one
whose address is not international — a national number, a short code;
typed, linked or the message's — and was typed or written under another
SIM's plan than the one known now, which the plan each row and the view
carry tells (the view's is that of the SIM the address was typed under,
which Number's AfterStatus keeps; Number's AnotherPlan, its second
caller)); Sync's StateChanged moves the bubble's caption. Keys reach the
field while a conversation is open (Escape goes back, Ctrl+Enter sends),
a held key repeats through a timer since frames are on demand, and the
caret blinks on one. A text typed and not sent is its conversation's,
not the view's: leaving the conversation (Back, another one opened by a
notification or a link) keeps it by the conversation's key for the run,
and opening the conversation again takes it up (Edit's Drafts: an empty
field keeps nothing and drops nothing; the draft of a typed or linked
address follows imsd's status as the open conversation's key does —
Number's AfterStatus over the address and the plan kept with it — so one
left before the status brought the country code is found under the key
the address makes afterwards; and a second text kept under one key — two
keys that became one — goes after the first on a line of its own).

Tested: tests/Model, the address a text goes to (the typed or linked
one, the latest message's, none for an emptied conversation, none under
another SIM's plan than it was typed or written under — a national
number with or without a trunk prefix under another country's SIM, a
short code under another operator's too, though dialled under the same
operator, the own number read when it was typed or not; a national
number typed before the own number was read, none under another operator
— an international one under any — and a typed address judged by its own
plan, whatever the latest row's); tests/Edit (code points of one to four
bytes, the moves within a line, the edits that change nothing, the first
line shown as the caret moves down a long text; the drafts: kept and
taken up by key with the cursor, taken once, an empty field keeping and
dropping nothing, one per conversation, a second text under one key on a
line of its own; a typed address's following the status — moved when the
code comes, not while texts are stored under its key, not under another
SIM's status, a list conversation's left alone and the store not asked,
the learned plan kept, two keys that became one keeping both texts).
2026-11-18 01:12:27 +01:00
dd1108da58
main: show the window; --screenshot and --quit-after
The executable shows the window at start unless --daemon (which
--headless and --send imply), on Activate and Open from a second launch
or a notification (of the URIs an Open carries, its first sms: link),
and on an sms: link, which opens the conversation of its first recipient
at once (Number's SmsUriRecipient: the scheme in any case, the fields
after '?' dropped, percent-escapes decoded; then ConversationKey with
the country code known at that moment — --country's, else the one imsd's
status gave once it is in, else what the number itself carries — which
takes NormalizeNumber's result as a phone number — E.164, or digits: a
short code, a national number no country code completed — and nothing
else), or just the window when it names no phone number; the
conversation remembers the address as dialled and the plan of the SIM it
was typed under, and that SIM's statuses move its key (Number's
AfterStatus, one step, applied in App::Status: another SIM's status —
another operator's, or without operators another own number's code,
Number's SameSim — changes nothing, so a SIM change leaves the key and
the plan the address was typed under; the same SIM's fills in what the
plan lacks, and the key follows from its digits to the centre's stand-in
and from any key to the own number's code once the plan has it, never
from one stand-in's key to another's and not while the code is lost, the
conversation it moves to shown at its latest message — and only while
nothing is stored under the key: a text stored before the code arrived
keeps the conversation on the key its rows carry). The shell forwards
Sync's events to the window and the notifier closes a conversation's
notification when it is opened (one closed while its Notify is on its
way goes when the answer comes). --screenshot renders one frame outside
the compositor's pacing 2.5 s after start — 600 ms later where it has to
make the window first — and saves it as a PNG before quitting, or ends
with exit 1 when no frame was captured — with a line when no window
could render it or another instance is running (a flag that acts on the
window finds none there: the run forwards nothing), and without one when
the run ended before the capture (the display gone, a close that quits);
a PNG the library cannot write is not noticed at this commit, and a
capture that throws ends the process — the verification path for a
machine without eyes, which must not depend on a desktop that repaints —
and --quit-after ends a bench on its own clock (a number of seconds its
timer can take: anything else is refused); a --send errand ended by
anything but its final state — that clock — exits 2, as it does on a
signal, its end latched before the loop stops; --screenshot beside
--send or --quit is refused, neither having a window. The window is torn
down in order before the bus client stops, and when the compositor's
connection breaks the process ends, so the next launch starts afresh. A
window the library cannot make (no display, no Vulkan driver) is logged
by Ui's Show and the start ends with exit 1, as a start without its
database does; a resident instance logs it and runs on without one, and
a later Activate or Open logs the same at once, the device's set-up
running only once.

Tested: tests/Number, the sms: links (a query, an escape, a list, the
scheme in capitals, no number), the keys of typed addresses, SameSim
(the same operator, another operator of one country, a status without
its operator, nothing known, own numbers' codes without operators) and
AfterStatus through the statuses a typed address meets: the stand-in
completing its digits while the plan learns the operator; another
stand-in, a lost code and another operator's status — its own number's
code the stand-in's or not — changing nothing; rows keeping the key
while the plan learns the code; the own number's code moving the
stand-in's key, at once or once nothing is stored; a key the own
number's code made, and its plan, staying under another SIM and under
its own SIM's stand-in; an own code that makes the stand-in's key; a
short code; --country before the operator; no operators; no address; an
international address, under another SIM and under its own; and the
address as dialled making the key the address as typed made.
2026-11-18 01:12:27 +01:00
6eea7228d0
Ui: the window on Crafter.Graphics, driven from the GLib main loop
The window library. Loop makes the Wayland display a GSource
(libwayland's prepare_read protocol) so D-Bus and the window are served
from one thread without the library's StartSync, which runs a loop of
its own that serves no GMainContext and would starve the bus; the app
owns its frame callback too — a redraw is a frame request and a bare
commit, the compositor's done runs one Window::Update, and nothing
re-arms unless something is dirty or animating — or the day changes: the
captions name the day and an idle window draws no frame by itself, so a
timer on the wall clock, which wakes at the next local midnight and
whenever that clock is set, asks for one when the local date is another
one (DayWatch); when the compositor's connection breaks the source stops
and says so (App's onDisplayLost), since the process cannot connect its
display again. Canvas initialises the device once per process and holds
the window, the font with a word wrapper and a text width over its
unrounded advances, as DrawText draws them, and four compositing layers
(background, the clipped scrolling content, the chrome, an overlay):
within one fused dispatch all quads composite before all text, so the
layers are separate dispatches in that order. The layers' buffer slots
hand their numbers back to the descriptor heap when they go, so the heap
is declared before them and outlives them. Screens draw the conversation
list (avatars, previews, time captions, unread badges, the
new-conversation button, with room under the last row to scroll clear of
it) and one conversation (day separators, wrapped bubbles, clock and
state captions — only what is in view, the layer's glyph budget being
finite) and record the regions a tap can hit. App wires them to the
store and Sync: mouse events become gestures (the detector's slop and
fling threshold set from the window's scale, the positions being buffer
pixels), a tap is resolved against the last frame's regions (which name
the conversation or message they drew, not a position a reload may
shift), scrolling is by wheel, drag or fling (a press stops a fling; a
screen change stops a fling and cancels the press under it, so the
scroll left behind keeps no velocity for a return to revive and a
release after a link's or a notification's Open is no tap on the new
screen), the window is created on the first Show (when the library
cannot and says so — no display, a compositor without wl_shm,
wl_compositor or xdg_wm_base, no Vulkan driver — Show logs why, Open
opens nothing, and the app runs on without one; a later Show fails at
once, the device's set-up running only once) and torn down in order on
Shutdown. ScreenshotThenQuit renders one frame outside the compositor's
pacing and saves it; a window it creates first waits 600 ms for the
compositor's configure, which sizes it (to the screen, on a phone). A
capture with no window to render it — none could be made, or it went
before the frame — is logged and sets App's exitCode to 1.

project.cpp gains Crafter.Graphics (--local takes the branch worktree with
the Wayland input work until it is merged), the imsd-messages-ui library,
and libevdev from the prefix of packaging/build-libevdev.sh on the
library's include path and the executable's library path (a sysroot
build looks for it in the sysroot instead).
2026-11-18 01:12:27 +01:00