wayland: Simplify MetaSelectionSourceWayland

Instead of taking resource and send/cancel funcs, take a
MetaWaylandDataSource, which exposes all the vfuncs to do the same on the
internal resource.

This has the added side effect that only MetaWaylandDataSource has a
pointer to the wl_resource, which may be unset untimely.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/842
This commit is contained in:
Carlos Garnacho
2019-10-11 17:09:26 +02:00
parent 227d272049
commit ea4665bf51
4 changed files with 31 additions and 61 deletions

View File

@ -25,6 +25,8 @@
#include <wayland-server.h>
#include "meta/meta-selection-source.h"
#include "wayland/meta-wayland-data-device.h"
#include "wayland/meta-wayland-data-device-private.h"
#define META_TYPE_SELECTION_SOURCE_WAYLAND (meta_selection_source_wayland_get_type ())
@ -33,14 +35,6 @@ G_DECLARE_FINAL_TYPE (MetaSelectionSourceWayland,
META, SELECTION_SOURCE_WAYLAND,
MetaSelectionSource)
typedef void (* MetaWaylandSendFunc) (struct wl_resource *resource,
const char *mimetype,
int fd);
typedef void (* MetaWaylandCancelFunc) (struct wl_resource *resource);
MetaSelectionSource * meta_selection_source_wayland_new (struct wl_resource *resource,
GList *mime_types,
MetaWaylandSendFunc send_func,
MetaWaylandCancelFunc cancel_func);
MetaSelectionSource * meta_selection_source_wayland_new (MetaWaylandDataSource *source);
#endif /* META_SELECTION_SOURCE_WAYLAND_H */