diff options
author | emersion <contact@emersion.fr> | 2018-11-27 20:16:55 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-11-27 20:16:55 +0100 |
commit | bfa7f4ee0dd5988ea54795862a12a1eb1680b3f7 (patch) | |
tree | a9ae2aa231eebf9cbb49afa70503d8277cbd700d /include | |
parent | cbe42d100644307af92f71a04b68a005c31c62d6 (diff) |
gtk-primary-selection: use impl pattern for sources
Diffstat (limited to 'include')
-rw-r--r-- | include/wlr/types/wlr_gtk_primary_selection.h | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/include/wlr/types/wlr_gtk_primary_selection.h b/include/wlr/types/wlr_gtk_primary_selection.h index ed025869..cbf29088 100644 --- a/include/wlr/types/wlr_gtk_primary_selection.h +++ b/include/wlr/types/wlr_gtk_primary_selection.h @@ -46,17 +46,23 @@ struct wlr_gtk_primary_selection_device { }; /** + * A data source implementation. Only the `send` function is mandatory. + */ +struct wlr_gtk_primary_selection_source_impl { + void (*send)(struct wlr_gtk_primary_selection_source *source, + const char *mime_type, int fd); + void (*destroy)(struct wlr_gtk_primary_selection_source *source); +}; + +/** * A source is the sending side of a selection. */ struct wlr_gtk_primary_selection_source { + const struct wlr_gtk_primary_selection_source_impl *impl; + // source metadata struct wl_array mime_types; - // source implementation - void (*send)(struct wlr_gtk_primary_selection_source *source, - const char *mime_type, int32_t fd); - void (*cancel)(struct wlr_gtk_primary_selection_source *source); - struct { struct wl_signal destroy; } events; @@ -75,8 +81,12 @@ void wlr_gtk_primary_selection_device_manager_set_selection( struct wlr_gtk_primary_selection_source *source); void wlr_gtk_primary_selection_source_init( + struct wlr_gtk_primary_selection_source *source, + const struct wlr_gtk_primary_selection_source_impl *impl); +void wlr_gtk_primary_selection_source_destroy( struct wlr_gtk_primary_selection_source *source); -void wlr_gtk_primary_selection_source_finish( - struct wlr_gtk_primary_selection_source *source); +void wlr_gtk_primary_selection_source_send( + struct wlr_gtk_primary_selection_source *source, const char *mime_type, + int fd); #endif |