ipc: expose surface_content_rect in get_tree#340
Conversation
This change fixes several runtime memory leaks in the compositor and swaybar,
and introduces a cleaner strategy for handling exit-time leaks under
LeakSanitizer (LSan) without requiring verbose shutdown-only cleanup code.
Runtime Leak Fixes:
- Compositor:
- Free temporary file list in `cmd_include` when processing `include` commands.
- Free `font_description` in `free_config` during config reloads.
- End seat operations in `handle_seat_destroy` to free seatop-specific state.
- Swaybar:
- Free `status->buffer` in `status_line_free` to avoid leaking the status line on updates.
Exit-Time Leak Strategy:
Instead of adding extensive code to traverse and free all global structures
(like container trees) at shutdown just to satisfy LSan, we run LSan checks
early before these structures are orphaned:
- Compositor:
- Manually invoke `__lsan_do_leak_check()` in `main.c` after `server_fini()`
has completed but before `root_destroy` or `free_config` are called.
- Prior to the leak check, clean up `pango`, `cairo`, and `fontconfig`
global static caches to avoid false positives.
- Since the global pointers `root` and `config` are still intact when LSan
runs, LSan correctly treats these structures as reachable rather than leaked,
allowing us to still run `root_destroy` and `free_config` afterwards
unconditionally.
- Added direct dependency on `fontconfig` in Meson build files to support direct calls to `FcFini()`.
- Swaybar:
- Wrap library cleanups and manual LSan invocation in `#ifdef __SANITIZE_ADDRESS__`
after `bar_teardown` in `main.c`.
- Add targeted LSan suppressions in `tests/lsan.supp` for exit-only DBus slot
allocations in the tray (`create_watcher`, `init_host`, etc.) that are not
worth cleaning up at shutdown.
Introduce new Lua APIs to query animation status and progress. Also includes testing infrastructure and tests: - Added `tests/test_leak_two_clients.py` to check for runtime leaks with clients active. - Added `tests/test_shutdown_events.py` and `tests/test_shutdown_lua_callbacks.py` to verify shutdown behavior and Lua callbacks. - Added `test_normal_exit_with_bar` to `tests/test_normal_exit.py` to ensure `scrollbar` is covered by LSan checks during normal shutdown.
66e8eb6 to
f38f23c
Compare
|
|
|
I think the |
Expose the actual view geometry (as set by the client via xdg-shell set_window_geometry) in the IPC get_tree output as 'surface_content_rect'. This is useful for clients using protocols like ext-image-copy-capture-v1 to capture foreign windows. Since the capture contains the full window surface (including Client-Side Decorations, shadows, etc.), the client needs to know the offset of the actual window content within the captured image. The surface_content_rect field exposes this offset (x, y) and size (width, height) relative to the surface.
|
OK, so you don't want coordinates to capture a part of the frame buffer like you would do with |
|
Is this for your project? Do you want to use the client buffer to create a static image for your suspended applications? If that is the case, I will merge it, but I have no way to test this otherwise. Most applications simply get the whole frame buffer and use |
f38f23c to
b1221c4
Compare
Expose the actual view geometry (as set by the client via xdg-shell set_window_geometry) in the IPC get_tree output as 'surface_content_rect'.
This is useful for clients using protocols like ext-image-copy-capture-v1 to capture foreign windows. Since the capture contains the full window surface (including Client-Side Decorations, shadows, etc.), the client needs to know the offset of the actual window content within the captured image. The surface_content_rect field exposes this offset (x, y) and size (width, height) relative to the surface.