Skip to content

ipc: expose surface_content_rect in get_tree#340

Open
jbms wants to merge 1 commit into
dawsers:masterfrom
jbms:ipc-surface-content-rect
Open

ipc: expose surface_content_rect in get_tree#340
jbms wants to merge 1 commit into
dawsers:masterfrom
jbms:ipc-surface-content-rect

Conversation

@jbms

@jbms jbms commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

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.

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.
@jbms jbms force-pushed the ipc-surface-content-rect branch from 66e8eb6 to f38f23c Compare June 26, 2026 07:05
@dawsers

dawsers commented Jun 26, 2026

Copy link
Copy Markdown
Owner

view->geometry always has {x, y} = {0, 0}, it is mainly used to know the rounded size of the content, so I think it will not serve for this purpose. If you want the offset of the content, the container has container->pending->content_* variables. These are in double precision, and then rounded with care to submit view_configure() events.

@jbms

jbms commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

I think the geometry field exposed via IPC always has x=0 and y=0, but I believe view->geometry is correct and may have a non-zero x/y coordinate when using client side decorations.

@dawsers

dawsers commented Jun 26, 2026

Copy link
Copy Markdown
Owner

OK, so you don't want coordinates to capture a part of the frame buffer like you would do with grim, you are expecting to get the buffer submitted by a client.

@dawsers

dawsers commented Jun 27, 2026

Copy link
Copy Markdown
Owner

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 rect or window_rect to get the part of the buffer they want

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants