mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-23 06:59:44 -05:00
Implement wlr_data_{source,device,device_manager}
This commit is contained in:
parent
e5fd858394
commit
86314caa5b
8 changed files with 398 additions and 0 deletions
15
include/wlr/interfaces/wlr_data_source.h
Normal file
15
include/wlr/interfaces/wlr_data_source.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef _WLR_INTERFACES_DATA_SOURCE_H
|
||||
#define _WLR_INTERFACES_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
|
||||
26
include/wlr/types/wlr_data_device_manager.h
Normal file
26
include/wlr/types/wlr_data_device_manager.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef _WLR_TYPES_DATA_DEVICE_MANAGER_H
|
||||
#define _WLR_TYPES_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
|
||||
32
include/wlr/types/wlr_data_source.h
Normal file
32
include/wlr/types/wlr_data_source.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#ifndef _WLR_TYPES_DATA_SOURCE_H
|
||||
#define _WLR_TYPES_DATA_SOURCE_H
|
||||
|
||||
#include <wayland-server.h>
|
||||
#include <wlr/util/list.h>
|
||||
|
||||
struct wlr_data_source_impl;
|
||||
|
||||
struct wlr_data_source {
|
||||
struct wlr_data_source_impl *impl;
|
||||
list_t *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
|
||||
|
|
@ -14,6 +14,7 @@ struct wlr_seat_handle {
|
|||
struct wl_resource *pointer;
|
||||
struct wl_resource *keyboard;
|
||||
struct wl_resource *touch;
|
||||
struct wl_resource *data_device;
|
||||
|
||||
struct wl_list link;
|
||||
};
|
||||
|
|
@ -23,6 +24,7 @@ struct wlr_seat {
|
|||
struct wl_list handles;
|
||||
char *name;
|
||||
uint32_t capabilities;
|
||||
struct wlr_data_device *data_device;
|
||||
|
||||
struct {
|
||||
struct wl_signal client_bound;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue