Skip to content

phase-3: BuffrDisplayWayland C subclass — WPEDisplay using buffr's wl_display #152

@mxaddict

Description

@mxaddict

Sub-task of #145 (re-scoped 2026-05-17). Depends on #145a (handles wired through).

Add a new C-side `BuffrDisplayWayland` GObject subclass of `WPEDisplay` to `csrc/wpe_subclasses.c`. Unlike stock `WPEDisplayWayland` (which opens its own wl_display), this subclass uses buffr's existing wl_display passed in at construction. Solves the cross-client subsurface problem.

Scope

```c
struct _BuffrDisplayWayland {
WPEDisplay parent_instance;
struct wl_display *wl_display;
struct wl_compositor *wl_compositor;
struct wl_subcompositor *wl_subcompositor;
struct wl_surface *parent_surface;
EGLDisplay egl_display;
};

BuffrDisplayWayland *buffr_display_wayland_new(
struct wl_display *,
struct wl_compositor *,
struct wl_subcompositor *,
struct wl_surface *parent,
EGLDisplay
);
```

vmethods to override:

  • `get_egl_display` → returns `self->egl_display`.
  • `get_keymap`, `get_screen` — can probably forward to a stub or replicate BuffrDisplay's behavior.
  • `create_view` → creates a `BuffrViewWayland` (#145c) with the same wl_*/EGL handles.
  • `connect` → no-op (we don't own the connection).

Reference impls

  • `csrc/wpe_subclasses.c::BuffrDisplay` — our existing OSR subclass. Mirror the structure (type registration via `g_type_register_static_simple`, vmethod table).
  • `/usr/include/wpe-webkit-2.0/wpe-platform/wpe/wpe-platform.h` — WPEDisplay base class API.

Rust shim

  • Add `buffr_display_wayland_new` to the extern declarations in `crates/buffr-webkit/src/platform/wpe_subclass.rs`.
  • Add a Rust constructor `BuffrDisplayWaylandHandle::new(...)` that calls the C function + wraps the pointer.
  • Add a new `WpeDisplayKind::BuffrWayland(BuffrDisplayWaylandHandle)` variant. The current `Wayland` variant (stock WPEDisplayWayland) will be removed or kept as a fallback.

Out of scope

  • The view subclass itself (#145c).
  • Any rendering (#145c handles that).

Acceptance

  • WebKitWebView can be constructed against a BuffrDisplayWayland — no errors.
  • create_view callback fires; we receive a BuffrViewWayland (still stubbed for rendering).

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