diff options
author | Tony Crisci <tony@dubstepdish.com> | 2018-01-04 06:15:17 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-04 06:15:17 -0500 |
commit | ce3a48c3169abf6c76a6aa4ce1ba0f81d0071bff (patch) | |
tree | ceed5ff582a9fd41fedba6076561748219590304 /include/wlr | |
parent | 767df15b029c7cb2f840591f465b81dd34bcfd83 (diff) | |
parent | c599d8024c5788aa4e15a026c46577723c8bb531 (diff) |
Merge pull request #542 from emersion/abstract-data-source
Abstract data sources
Diffstat (limited to 'include/wlr')
-rw-r--r-- | include/wlr/types/wlr_data_device.h | 36 | ||||
-rw-r--r-- | include/wlr/types/wlr_primary_selection.h | 10 | ||||
-rw-r--r-- | include/wlr/types/wlr_seat.h | 3 |
3 files changed, 28 insertions, 21 deletions
diff --git a/include/wlr/types/wlr_data_device.h b/include/wlr/types/wlr_data_device.h index 92d15972..54514b4c 100644 --- a/include/wlr/types/wlr_data_device.h +++ b/include/wlr/types/wlr_data_device.h @@ -23,33 +23,39 @@ struct wlr_data_offer { struct wl_resource *resource; struct wlr_data_source *source; - uint32_t dnd_actions; - enum wl_data_device_manager_dnd_action preferred_dnd_action; + uint32_t actions; + enum wl_data_device_manager_dnd_action preferred_action; bool in_ask; struct wl_listener source_destroy; }; struct wlr_data_source { - struct wl_resource *resource; - struct wlr_data_offer *offer; - struct wlr_seat_client *seat_client; - + // source metadata struct wl_array mime_types; + int32_t actions; + + // source implementation + void (*send)(struct wlr_data_source *source, const char *mime_type, + int32_t fd); + void (*accept)(struct wlr_data_source *source, uint32_t serial, + const char *mime_type); + void (*cancel)(struct wlr_data_source *source); + // drag'n'drop implementation + void (*dnd_drop)(struct wlr_data_source *source); + void (*dnd_finish)(struct wlr_data_source *source); + void (*dnd_action)(struct wlr_data_source *source, + enum wl_data_device_manager_dnd_action action); + + // source status bool accepted; + struct wlr_data_offer *offer; + struct wlr_seat_client *seat_client; - // drag and drop + // drag'n'drop status enum wl_data_device_manager_dnd_action current_dnd_action; - uint32_t dnd_actions; uint32_t compositor_action; - bool actions_set; - - void (*accept)(struct wlr_data_source *source, uint32_t serial, - const char *mime_type); - void (*send)(struct wlr_data_source *source, const char *mime_type, - int32_t fd); - void (*cancel)(struct wlr_data_source *source); struct { struct wl_signal destroy; diff --git a/include/wlr/types/wlr_primary_selection.h b/include/wlr/types/wlr_primary_selection.h index b4eceb78..da3c096a 100644 --- a/include/wlr/types/wlr_primary_selection.h +++ b/include/wlr/types/wlr_primary_selection.h @@ -15,16 +15,18 @@ struct wlr_primary_selection_device_manager { struct wlr_primary_selection_offer; struct wlr_primary_selection_source { - struct wl_resource *resource; - struct wlr_primary_selection_offer *offer; - struct wlr_seat_client *seat_client; - + // source metadata struct wl_array mime_types; + // source implementation void (*send)(struct wlr_primary_selection_source *source, const char *mime_type, int32_t fd); void (*cancel)(struct wlr_primary_selection_source *source); + // source status + struct wlr_primary_selection_offer *offer; + struct wlr_seat_client *seat_client; + struct { struct wl_signal destroy; } events; diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h index e049d4c7..432e5dc3 100644 --- a/include/wlr/types/wlr_seat.h +++ b/include/wlr/types/wlr_seat.h @@ -178,8 +178,7 @@ struct wlr_seat { uint32_t capabilities; struct timespec last_event; - struct wlr_data_device *data_device; // TODO needed? - struct wlr_data_source *selection_source; + struct wlr_data_source *selection_data_source; uint32_t selection_serial; struct wlr_primary_selection_source *primary_selection_source; |