diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-10-24 08:22:13 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-24 08:22:13 -0400 |
commit | bbf08f3ef9cf831c6af49060871995eaa0963bca (patch) | |
tree | 005f9540a0d68f827eb0024a1fb4bf53f48a4f20 /include | |
parent | 93042e844be026e05a3120385af530c406bb695e (diff) | |
parent | 1dbe31493708790f6fafb4c9da8d24cbb3fa07b9 (diff) |
Merge pull request #262 from acrisci/feature/data-device-selection
wlr-data-device
Diffstat (limited to 'include')
-rw-r--r-- | include/rootston/input.h | 13 | ||||
-rw-r--r-- | include/rootston/server.h | 2 | ||||
-rw-r--r-- | include/wlr/interfaces/wlr_data_source.h | 16 | ||||
-rw-r--r-- | include/wlr/types/wlr_data_device.h | 89 | ||||
-rw-r--r-- | include/wlr/types/wlr_data_device_manager.h | 26 | ||||
-rw-r--r-- | include/wlr/types/wlr_data_source.h | 32 | ||||
-rw-r--r-- | include/wlr/types/wlr_seat.h | 20 |
7 files changed, 119 insertions, 79 deletions
diff --git a/include/rootston/input.h b/include/rootston/input.h index ddd5a05d..33750d7b 100644 --- a/include/rootston/input.h +++ b/include/rootston/input.h @@ -64,6 +64,17 @@ struct roots_input_event { struct wlr_input_device *device; }; +struct roots_drag_icon { + struct wlr_surface *surface; + struct wl_list link; // roots_input::drag_icons + + int32_t sx; + int32_t sy; + + struct wl_listener surface_destroy; + struct wl_listener surface_commit; +}; + struct roots_touch_point { struct roots_touch *device; int32_t slot; @@ -80,6 +91,7 @@ struct roots_input { struct wlr_xcursor_theme *theme; struct wlr_xcursor *xcursor; struct wlr_seat *wl_seat; + struct wl_list drag_icons; struct wl_client *cursor_client; enum roots_cursor_mode mode; @@ -113,6 +125,7 @@ struct roots_input { struct wl_listener cursor_tool_axis; struct wl_listener cursor_tool_tip; + struct wl_listener pointer_grab_begin; struct wl_list touch_points; struct wl_listener pointer_grab_end; diff --git a/include/rootston/server.h b/include/rootston/server.h index a4eacb7f..8fc6530e 100644 --- a/include/rootston/server.h +++ b/include/rootston/server.h @@ -3,7 +3,7 @@ #include <wayland-server.h> #include <wlr/backend.h> #include <wlr/backend/session.h> -#include <wlr/types/wlr_data_device_manager.h> +#include <wlr/types/wlr_data_device.h> #include <wlr/render.h> #ifdef HAS_XWAYLAND #include <wlr/xwayland.h> diff --git a/include/wlr/interfaces/wlr_data_source.h b/include/wlr/interfaces/wlr_data_source.h deleted file mode 100644 index 821bdea0..00000000 --- a/include/wlr/interfaces/wlr_data_source.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef WLR_INTERFACES_WLR_DATA_SOURCE_H -#define WLR_INTERFACES_WLR_DATA_SOURCE_H - -#include <wlr/types/wlr_data_source.h> - -struct wlr_data_source_impl { - void (*send)(struct wlr_data_source *data_source, const char *type, int fd); - void (*accepted)(struct wlr_data_source *data_source, const char *type); - void (*cancelled)(struct wlr_data_source *data_source); -}; - -bool wlr_data_source_init(struct wlr_data_source *source, - struct wlr_data_source_impl *impl); -void wlr_data_source_finish(struct wlr_data_source *source); - -#endif diff --git a/include/wlr/types/wlr_data_device.h b/include/wlr/types/wlr_data_device.h new file mode 100644 index 00000000..e1e1e516 --- /dev/null +++ b/include/wlr/types/wlr_data_device.h @@ -0,0 +1,89 @@ +#ifndef WLR_TYPES_WLR_DATA_DEVICE_H +#define WLR_TYPES_WLR_DATA_DEVICE_H + +#include <wayland-server.h> +#include <wlr/types/wlr_seat.h> + +extern const struct +wlr_pointer_grab_interface wlr_data_device_pointer_drag_interface; + +extern const struct +wlr_keyboard_grab_interface wlr_data_device_keyboard_drag_interface; + +struct wlr_data_device_manager { + struct wl_global *global; +}; + +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; + bool in_ask; + + struct wl_listener source_destroy; +}; + +struct wlr_data_source { + struct wl_resource *resource; + struct wlr_data_offer *offer; + struct wlr_seat_handle *seat; + struct wl_array mime_types; + + bool accepted; + + // drag and drop + 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; + } events; +}; + +struct wlr_drag { + struct wlr_seat_pointer_grab pointer_grab; + struct wlr_seat_keyboard_grab keyboard_grab; + + struct wlr_seat_handle *handle; + struct wlr_seat_handle *focus_handle; + + struct wlr_surface *icon; + struct wlr_surface *focus; + struct wlr_data_source *source; + + struct wl_listener icon_destroy; + struct wl_listener source_destroy; + struct wl_listener handle_unbound; +}; + +/** + * Create a wl data device manager global for this display. + */ +struct wlr_data_device_manager *wlr_data_device_manager_create( + struct wl_display *display); + +/** + * Creates a new wl_data_offer if there is a wl_data_source currently set as the + * seat selection and sends it to the client for this handle, followed by the + * wl_data_device.selection() event. + * If there is no current selection, the wl_data_device.selection() event will + * carry a NULL wl_data_offer. + * If the client does not have a wl_data_device for the seat nothing * will be + * done. + */ +void wlr_seat_handle_send_selection(struct wlr_seat_handle *handle); + +void wlr_seat_set_selection(struct wlr_seat *seat, + struct wlr_data_source *source, uint32_t serial); + +#endif diff --git a/include/wlr/types/wlr_data_device_manager.h b/include/wlr/types/wlr_data_device_manager.h deleted file mode 100644 index 500f8acd..00000000 --- a/include/wlr/types/wlr_data_device_manager.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef WLR_TYPES_WLR_DATA_DEVICE_MANAGER_H -#define WLR_TYPES_WLR_DATA_DEVICE_MANAGER_H - -#include <wayland-server.h> - -struct wlr_data_device_manager { - struct wl_global *global; -}; - -struct wlr_data_device_manager *wlr_data_device_manager_create(struct wl_display *dpy); -void wlr_data_device_manager_destroy(struct wlr_data_device_manager *manager); - -struct wlr_data_device { - struct wlr_seat *seat; - struct wlr_data_source *selection; - struct wl_listener selection_destroyed; - - struct { - struct wl_signal selection_change; - } events; -}; - -void wlr_data_device_set_selection(struct wlr_data_device *manager, - struct wlr_data_source *source); - -#endif diff --git a/include/wlr/types/wlr_data_source.h b/include/wlr/types/wlr_data_source.h deleted file mode 100644 index f54ac0a9..00000000 --- a/include/wlr/types/wlr_data_source.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef WLR_TYPES_WLR_DATA_SOURCE_H -#define WLR_TYPES_WLR_DATA_SOURCE_H - -#include <wayland-server.h> -#include <wlr/types/wlr_list.h> - -struct wlr_data_source_impl; - -struct wlr_data_source { - struct wlr_data_source_impl *impl; - struct wlr_list *types; - void *data; - - struct { - struct wl_signal destroy; - } events; -}; - -void wlr_data_source_send(struct wlr_data_source *src, const char *type, int fd); -void wlr_data_source_accepted(struct wlr_data_source *src, const char *type); -void wlr_data_source_cancelled(struct wlr_data_source *src); - -struct wlr_wl_data_source { - struct wlr_data_source base; - struct wl_resource *resource; -}; - -struct wlr_wl_data_source *wlr_wl_data_source_create( - struct wl_client *client, - uint32_t version, uint32_t id); - -#endif diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h index d267924c..f5d5c357 100644 --- a/include/wlr/types/wlr_seat.h +++ b/include/wlr/types/wlr_seat.h @@ -75,11 +75,16 @@ struct wlr_seat_pointer_state { struct wlr_seat_handle *focused_handle; struct wlr_surface *focused_surface; - struct wl_listener surface_destroy; - struct wl_listener resource_destroy; - struct wlr_seat_pointer_grab *grab; struct wlr_seat_pointer_grab *default_grab; + + uint32_t button_count; + uint32_t grab_button; + uint32_t grab_serial; + uint32_t grab_time; + + struct wl_listener surface_destroy; + struct wl_listener resource_destroy; }; struct wlr_seat_keyboard { @@ -111,11 +116,16 @@ struct wlr_seat { struct wl_list keyboards; char *name; uint32_t capabilities; - struct wlr_data_device *data_device; + + struct wlr_data_device *data_device; // TODO needed? + struct wlr_data_source *selection_source; + uint32_t selection_serial; struct wlr_seat_pointer_state pointer_state; struct wlr_seat_keyboard_state keyboard_state; + struct wl_listener selection_data_source_destroy; + struct { struct wl_signal client_bound; struct wl_signal client_unbound; @@ -127,6 +137,8 @@ struct wlr_seat { struct wl_signal keyboard_grab_end; struct wl_signal request_set_cursor; + + struct wl_signal selection; } events; void *data; |