Commit Graph

2233 Commits

Author SHA1 Message Date
Geoffrey McRae
3e9491dbea [client] wayland: fix MATE clipboard MIME handling
Treat either GNOME or MATE copied-files data as preferred over the URI
list fallback. The previous pair of strcmp conditions could never both
be false, so a MATE offer could not replace an earlier URI list.

GNOME and MATE use the same copied-files representation. Generate that
payload once and serve it under both advertised MIME names instead of
overwriting and leaking the first allocation.
2026-08-15 20:43:56 +10:00
Geoffrey McRae
52d9ab10a0 [client] clipboard: add support for Caja 2026-08-15 20:29:08 +10:00
Geoffrey McRae
cecd4b6f48 [client] tests: exercise mandatory LGMP streams
Replace legacy clipboard grant and queued input fixtures with bound SPSC
stream endpoints. Verify stream-only payload delivery, credit recovery,
release completion, and four 256 KiB records for a 1 MiB response.

Keep queue assertions for status, discovery, ownership, and control.
2026-08-15 14:51:24 +10:00
Geoffrey McRae
be4bb19fa4 [clipboard] lgmp: make payload streams mandatory
Carry DATA and FILE_DATA only through the duplex SPSC streams. Keep LGMP
queues for control and status. Remove grants, commits, ACKs, and
queue-payload transport negotiation.

Poll adaptively while ownership or release is active. Preserve FIFO
release and graceful draining. Quarantine payloads crossed by a newer
OFFER or CLEAR, and retire data-plane state on detach.
2026-08-15 14:51:24 +10:00
Geoffrey McRae
12801df353 [input] lgmp: make report streams mandatory
Carry every input activation and report through its client-bound SPSC
stream. Keep the LGMP queue only for status publication and subscriber
discovery, removing transport selection and the queue-report fallback.

Retain graceful endpoint draining when a subscriber disappears and use
bounded adaptive polling while streams are active. The IDD polling setup
remains compatible with the project’s current C++ language mode.
2026-08-15 14:51:24 +10:00
Geoffrey McRae
a2dd4c246d [client] input: publish reports through streams
Select the endpoint bound to this LGMP client and send each complete
input activation through its reliable fixed-slot stream.

Track the transport with every pending and published record so CLAIM,
reports, KEEPALIVE, RESET, and RELEASE cannot cross data planes.

Latch queue fallback for the connection after it is selected, avoiding
cross-generation reordering if a stream appears later. Preserve motion
coalescing and the existing queue retry behavior.
2026-08-15 14:38:16 +10:00
Geoffrey McRae
d28f576145 [client] clipboard: use LGMP payload streams
Attach the advertised clipboard lanes before claiming ownership, prefer
the stream transport, and activate only the acknowledged client and
epoch binding.

Move representation and file payloads through fixed-slot reservations
while status and lifecycle control remain on the LGMP queue. Retain a
legacy v4 fallback for other hosts.

Hold each host-to-client reservation until the consumer accepts its
record, return credits in order, and drain queued traffic in bounded
bursts before sleeping.
2026-08-15 14:38:16 +10:00
Geoffrey McRae
a6a9c909b7 [client] clipboard: fix pasting into Nautilus
Some checks failed
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / module (push) Has been cancelled
build / host-linux (push) Has been cancelled
build / host-windows-cross (push) Has been cancelled
build / host-windows-native (push) Has been cancelled
build / idd (push) Has been cancelled
build / obs (clang) (push) Has been cancelled
build / obs (gcc) (push) Has been cancelled
build / docs (push) Has been cancelled
Yet again we have to implement a fix for another Gnome-ism. Why they
dont just implement standard such as rfc2483 is beyond me. Instead they
have decided to implement the undocumented format
`x-special/gnome-copied-files`. You would think that they could at least
remain compatible by trimming `\r` from the lines.

I am so glad KDE is good these days
2026-08-15 11:31:08 +10:00
Geoffrey McRae
97b249b49b [client] cosmetics/naming cleanup 2026-08-15 01:34:40 +10:00
Geoffrey McRae
c11842a43c [client] tests: include clipboard protocol constants
The X11 clipboard test directly checks the protocol representation chunk
limit. Include the header that defines the constant instead of relying on
a transitive include from the implementation translation unit.
2026-08-15 01:17:58 +10:00
Geoffrey McRae
6631fde35f [client] clipboard: reduce remote file transfer latency
Mark the last non-empty FILE_DATA payload with BEGIN and END when the
producer knows it is terminal. Complete producer bookkeeping in the
following fileDataEnd call without consuming another LGMP grant. Keep
the standalone terminal record for empty and legacy unknown streams.

Drain up to 64 queued clipboard records per worker pass instead of
sleeping after every message. Poll at 1 ms while transfers, blocked
writes, held input, or pending output are active, and retain the 10 ms
interval while idle.

This removes a serialized grant round trip from every non-empty file
response and reduces scheduling delay while a large transfer is active.
Keep the 1 MiB payload size because the bottleneck was stop-and-wait
latency, not the chunk capacity.

Exercise a full 1 MiB response in a single BEGIN|END grant and retain
coverage for empty unknown-size responses.
2026-08-15 01:13:13 +10:00
Geoffrey McRae
f9ffce528a [idd] helper: run interactive process as desktop user
Explorer file copies were invisible to the Helper because the service
launched its child with a duplicate of the LocalSystem token and changed
only TokenSessionId. The child therefore remained a System-integrity
process. Windows filtered Explorer's file clipboard formats across that
integrity boundary. Basic text and bitmap formats continued to work.

Keep only the SCM service privileged. Obtain the active session user's
primary token with WTSQueryUserToken. For elevated accounts, prefer the
linked limited token. Validate its session and security properties.
Build the user environment and launch the interactive Helper on
WinSta0\Default. Gate Helper activation until the service has rechecked
the active session and registered the clipboard authority.

Use random lifetime, stop, and activation objects owned by the service.
Give the target logon SID synchronization access only. Recheck the
active console session and service state before activation. Make the
lifetime mutex terminate the Helper if the service exits unexpectedly.
Restart it when the active session, IDD host, or authority changes.

Replace the old process-handle mapping transfer with a device-bound
authority protocol on the LGIdd device interface. The service verifies
the exact driver host instance, duplicates only section map rights into
that process, and registers the session, mapping identifier, and handle.
Bind authority lifetime to its WDF file object, revoke it synchronously
on cleanup, and poll the driver host identity while the child is active.

Restrict the device stack to SYSTEM and isolate LGIdd in a unique UMDF
device group. Restrict the shared section to SYSTEM and the target logon
SID. Apply a medium mandatory label that prevents low-integrity readers
and writers. Map it with read/write rights instead of all access.

Give each clipboard mapping a second random authority identifier. Store
it only inside the logon-SID-protected mapping and send it in the
mandatory HELLO. LGIdd matches it against the service-injected mapping.
This authenticates the user Helper without the unsupported UMDF call to
GetNamedPipeClientSessionId. Have the Helper verify that its pipe server
is in session zero.

Extend the pipe endpoint with bounded authentication reads, cancellable
overlapped I/O, periodic authorization checks, and explicit disconnects.
Serialize authority changes with clipboard attach and detach. Prevent
stale cleanup from tearing down a replacement mapping. Disconnect the
user pipe immediately when its owning authority is revoked.

Run clipboard, OLE, display, configuration, and file access in the
user's interactive process. Retain its process token for worker-thread
file operations instead of querying and impersonating the desktop user
from a System process. Store Helper logs in LocalAppData and grant only
the registry rights needed by interactive configuration and UMDF.

Keep immediate, stage-specific Win32 and HRESULT diagnostics throughout
clipboard capture. Probe CF_HDROP while holding the Win32 clipboard and
enumerate the OLE object's advertised file formats. Validate returned
storage and fall back to Shell item paths when direct retrieval fails.
Validate clipboard sequence changes and defer retries during contention
without publishing incomplete clipboard state.

Complete the 1 MiB transfer work with full-sized Windows copy buffers.
Use full-sized FUSE reads and retain the named 64 KiB X11 chunk limit.
Validate the user-writable mapping with CClipboardRing before attaching.

The pipe, mapping, and authority protocols change together. LGIdd.dll,
the INF, and LGIddHelper.exe must be rebuilt and installed as one
matching set.
2026-08-15 00:42:24 +10:00
Geoffrey McRae
352c3c42b6 [common] clipboard: enlarge transfer buffers 2026-08-14 19:09:11 +10:00
Geoffrey McRae
42cec4774b [client] clipboard: expose shared headers 2026-08-14 19:09:11 +10:00
Geoffrey McRae
a841be3515 [client] lgmp: transport clipboard files 2026-08-14 19:09:11 +10:00
Geoffrey McRae
a91343be96 [client] clipboard: add seamless file backends 2026-08-14 19:09:11 +10:00
Geoffrey McRae
20c63464a7 [client] clipboard: retain local Wayland offers 2026-08-14 12:36:43 +10:00
Geoffrey McRae
608e85fe5d [client] clipboard: preserve newer Wayland selections 2026-08-14 12:36:43 +10:00
Geoffrey McRae
dc2ab76c36 [client] clipboard: suppress Wayland self-copy feedback 2026-08-14 12:36:43 +10:00
Geoffrey McRae
c868082a7f [client/idd] fix copyright headers 2026-08-14 12:36:43 +10:00
Geoffrey McRae
be2f79a412 [client] clipboard: add direct LGMP synchronization 2026-08-14 10:22:37 +10:00
Geoffrey McRae
a8d531b797 [client] clipboard: introduce streamed transfers 2026-08-14 10:09:10 +10:00
Geoffrey McRae
4768396180 [client] transport: track video component availability 2026-08-13 04:28:09 +10:00
Geoffrey McRae
656b0995f6 [client] transport: make video waits cancellable 2026-08-13 04:08:49 +10:00
Amit Mendapara
13b6e04256 [client] wayland: apply the surface scale before the first commit
The buffer scale and viewport were only set from the resize handling in
the swap path, which runs after the buffer has been committed. The first
commit therefore carried a buffer of scale x the window size with no
scale declared, so the compositor sized the window from the raw buffer.
On a scaled output that is larger than the work area GNOME maximizes it,
after which libdecor drops every resize as the frame is no longer
floating, leaving the window stuck at the size of the display.

Split the scaling out of the swap path and apply it when the EGL window
is created, so it is in place for the first commit.
2026-08-12 14:55:42 +10:00
Geoffrey McRae
52f7c3a896 [client] audio: adapt buffer to network jitter
Some checks failed
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / module (push) Has been cancelled
build / host-linux (push) Has been cancelled
build / host-windows-cross (push) Has been cancelled
build / host-windows-native (push) Has been cancelled
build / idd (push) Has been cancelled
build / obs (clang) (push) Has been cancelled
build / obs (gcc) (push) Has been cancelled
build / docs (push) Has been cancelled
2026-08-12 14:36:57 +10:00
Geoffrey McRae
173316a5a9 [client] audio: handle USB transport backpressure 2026-08-12 14:36:50 +10:00
Geoffrey McRae
573204d44e [client] audio: discard stale playback backlog 2026-08-12 13:43:07 +10:00
Geoffrey McRae
88b9bc32d1 [client] audio: learn underrun delivery jitter 2026-08-12 13:10:11 +10:00
Geoffrey McRae
b30ef31f34 [client] audio: conceal failed USB packets 2026-08-12 13:08:06 +10:00
Geoffrey McRae
a4d38ccb98 [client] audio: schedule USB feedback independently 2026-08-12 13:02:58 +10:00
Geoffrey McRae
8fb3c4d9f6 [client] transport: stop after guest sessions end
Track unexpected loss of an admitted fallback independently from normal
stop and UUID revocation. Terminate once both primary and fallback
sessions have disappeared, regardless of notification order.

Make shutdown terminal so concurrent disconnect handling cannot replace
it with restart or running state.
2026-08-12 12:24:25 +10:00
Geoffrey McRae
2d96ec401c [client] app: clear display server state before teardown 2026-08-12 12:24:25 +10:00
Amit Mendapara
ada355e429 [client] app: free the frame event after display server teardown
Some checks failed
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / module (push) Has been cancelled
build / host-linux (push) Has been cancelled
build / host-windows-cross (push) Has been cancelled
build / host-windows-native (push) Has been cancelled
build / idd (push) Has been cancelled
build / obs (clang) (push) Has been cancelled
build / obs (gcc) (push) Has been cancelled
build / docs (push) Has been cancelled
Display server and overlay teardown can still call app_invalidateWindow,
which signals the frame event; the Wayland presentation module does so
when it unregisters its graph. Freeing the event beforehand asserted in
lgSignalEvent while closing the client.
2026-08-12 11:57:56 +10:00
Geoffrey McRae
81be5a388a [client] render: bind invalidation to queue batches 2026-08-12 05:31:45 +10:00
Geoffrey McRae
9c0caca3fa [client] render: bound software surface update backlog 2026-08-12 05:31:45 +10:00
Geoffrey McRae
f68bf8f0d5 [client] render: reduce software surface queue overhead 2026-08-12 05:31:45 +10:00
Geoffrey McRae
f9a60bd2d1 [client] opengl: optimize software surface uploads 2026-08-12 05:31:45 +10:00
Geoffrey McRae
0c21577e9e [client] render: optimize software surface fills 2026-08-12 05:31:45 +10:00
Geoffrey McRae
5e8066609a [client] egl: track software surface damage 2026-08-12 05:20:56 +10:00
Geoffrey McRae
1a236c5e3a [client] egl: upload software surface damage only 2026-08-12 05:20:56 +10:00
Geoffrey McRae
bd5d07fa4f [client] render: reject empty cursor images 2026-08-12 05:05:27 +10:00
Geoffrey McRae
fbcf71e777 [client] config: reject malformed window geometry 2026-08-12 05:05:27 +10:00
Geoffrey McRae
db1c8bf671 [client] message: reset resize debounce state 2026-08-12 05:05:27 +10:00
Geoffrey McRae
51006f9f76 [client] scheduler: retain pending control flags 2026-08-12 05:05:27 +10:00
Geoffrey McRae
f8cf0740e3 [client] keybind: validate and consume chord events 2026-08-12 05:05:27 +10:00
Geoffrey McRae
7b5936574c [client] keybind: release guest chords in reverse 2026-08-12 05:05:27 +10:00
Geoffrey McRae
9cbf24690b [client] x11: reject null clipboard payloads 2026-08-12 05:05:26 +10:00
Geoffrey McRae
1c7664dc5c [client] wayland: release ignored clipboard offers 2026-08-12 05:05:26 +10:00
Geoffrey McRae
6525c3a759 [client] lgmp: restore held mouse mode 2026-08-12 05:05:26 +10:00