Skip to content

Introduce master output class and make use of wl_global_remove

Roman Gilg requested to merge romangg/wrapland:server-output into master

Synopsis

There are two big changes.

The first one is a refactoring of our Server API to provide a single access point for compositors to deal with output representations on the Wayland side. The second is that we now make use of wl_global_remove which is available since libwayland 1.18 and allows us to mitigate an accidental racy design in libwayland by delaying the destruction of wl_globals.

In detail

  • Previous Output class is renamed to WlOutput.
  • Legacy remote-access protocol and API is removed.
  • Create new Output class that bundles all API for the now dependent classes WlOutput, XdgOutput and OutputDeviceV1.
    • State changes are double-buffered, applied atomically.
    • Enabling and disabling an output creates and destroys wl_output and xdg-output protocol objects automatically.
    • Client scale is calculated automatically from logical size and mode size.
  • Require libwayland 1.18 for wl_global_remove.
  • Separate Bind class is introduced that represents the bind of a client to a global.
    • send functions become free functions that can be used from Bind and Resource classes independently.
    • Functionality in regards to binds is removed from Resource class.
  • Introduce Nucleus class for Global objects.
    • A Nucleus instance contains all client-side relevant information.
    • Contains in particular the capsule for the wl_global object.
    • Lives on after the wl_global has been removed. Is destroyed when the delay timer runs out or the Display goes down.
    • Checks on every bind and callback what state the wl_global is in (active, removed, destroyed) and accordingly guards against use after free.
  • Relevant test is enabled again to prove our wl_global_remove implementation is working correctly.

Closes #13 (closed), #70 (closed)

Edited by Roman Gilg

Merge request reports