Skip to content

phase-3: create wl_subsurface from parent + attach WebKit's wl_surface as child #145

@mxaddict

Description

@mxaddict

With `WPEDisplayWayland` running (#144) and the trait API in place (#143), this issue implements `set_native_parent` to actually wire WebKit's `wl_surface` as a subsurface of buffr's winit `wl_surface`.

Scope

```rust
fn set_native_parent(&self, parent: RawWindowHandle, rect: NativeRect) {
// Extract wl_surface ptr from parent handle (Wayland variant only).
// Extract WebKit's wl_surface via wpe_view_wayland_get_wl_surface(view).
// Get wl_compositor from WPEDisplayWayland::get_wl_compositor.
// Get wl_subcompositor (need separate wl_registry roundtrip — file as
// sub-bullet if not trivially accessible).
// Call wl_subcompositor::get_subsurface(child=webkit_surface, parent=winit_surface).
// wl_subsurface::set_position(rect.x, rect.y).
// wl_subsurface::set_sync() — sync with parent commits so chrome + page
// tear-free; the apps layer's wgpu commit drives both.
}
```

Subcompositor access

`wpe_display_wayland_get_wl_compositor` exists but no `get_wl_subcompositor`. Bind via wl_registry: listen for `wl_subcompositor` global, store handle. Can do this from buffr-app side instead — pass both wl_compositor + wl_subcompositor down via the `set_native_parent` call. Cleaner.

Alternative: use `smithay-client-toolkit` 0.20 in buffr-webkit. Heavyweight; prefer raw wl_registry roundtrip.

Resize handling

When `resize(w, h)` fires:

  • Resize webkit's WPEToplevel (already wired).
  • Re-issue `wl_subsurface::set_position` if rect.x/y changed (chrome-strip height changed, etc).
  • The wl_surface buffer commits handle their own scaling.

Cleanup

`Drop` for the subsurface struct: `wl_subsurface::destroy`.

Scope

  • Add raw Wayland FFI to buffr-webkit (extern `wl_compositor_`, `wl_subcompositor_`, `wl_subsurface_*`). Bindgen against `wayland-client.h` (already linked via WPE).
  • New `WaylandSubsurface` struct holding the child wl_subsurface pointer + parent wl_surface borrow.

Out of scope

Acceptance

  • Tab 1 paint shows page pixels in the browser region of buffr's window without OSR readback.
  • vmstat 1 shows substantially lower CPU during steady-state page rendering than the OSR path (CEF readback was the main consumer).

Reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestparkedDormant — feature kept in backlog but not actively worked on

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions