• Nick Diego Yamane's avatar
    ozone/wayland: Decouple DataSource implementation from its client code · 8c330007
    Nick Diego Yamane authored
    This contains a major rework of DataSource support in Ozone Wayland
    backend. Just like other recent refactors in data exchange related code,
    such as https://crrev.com/c/2205881, the primary goal of this one is to
    decouple "client code" from core implementation and interface of
    *DataSource classes, so making it easier to maintain, extend, read, etc
    etc as well as maximizing code reusage and will reduce complexity to
    implement use cases such as Tab/Window Dragging.
    
    To accomplish it, this CL:
    
    1. Switches DataSource implementations to a template-based (instead of
    using inheritance) approach in order to support *slightly* different
    backing protocol extensions and maximize code reusage and consistency
    on what is shared. For now there are 2 variants, one for the standard
    wl_data_source protocol object and another one for gtk-primary-selection
    extension (and probably a new one coming soon [2]).
    
    2. Introduces DataSource::Delegate interface, through which the relevant
    data source events are forwarded to "client code", eg: WaylandClipboard,
    WaylandDataDragController, etc.
    
    3. Refactors DataSource clients, mainly WaylandClipboard, making use of
    the new template class instances to reach a cleaner and easier to extend
    implementation of PlatformClipboard, seamlessly supporting both regular
    and primary selection clipboard buffers.
    
    4. Get rid of unneeded classes and source files.
    
    No functional changes is expected and follow up changes should be done
    in the future to switch the Device and Offer counterparts to a similar
    architecture.
    
    [1] https://gitlab.gnome.org/GNOME/mutter/-/blob/master/src/wayland/protocol/gtk-primary-selection.xml
    [2] https://bugs.chromium.org/p/chromium/issues/detail?id=1088132
    
    Bug: 896640
    Change-Id: Iaf035dd106c6ab9488f44cfd8fb425ff3cd354db
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2222147Reviewed-by: default avatarMaksim Sisov <msisov@igalia.com>
    Commit-Queue: Nick Yamane <nickdiego@igalia.com>
    Cr-Commit-Position: refs/heads/master@{#776903}
    8c330007
wayland_clipboard.h 3.08 KB