mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-15 06:59:43 -05:00
Implement xwayland primary selection sync
This commit is contained in:
parent
4d744aeb23
commit
6dffaa7bb7
7 changed files with 462 additions and 283 deletions
|
|
@ -927,6 +927,11 @@ static struct wl_data_source_interface data_source_impl = {
|
|||
.set_actions = data_source_set_actions,
|
||||
};
|
||||
|
||||
void wlr_data_source_init(struct wlr_data_source *source) {
|
||||
wl_array_init(&source->mime_types);
|
||||
wl_signal_init(&source->events.destroy);
|
||||
}
|
||||
|
||||
static void data_device_manager_create_data_source(struct wl_client *client,
|
||||
struct wl_resource *resource, uint32_t id) {
|
||||
struct wlr_data_source *source = calloc(1, sizeof(struct wlr_data_source));
|
||||
|
|
@ -934,25 +939,21 @@ static void data_device_manager_create_data_source(struct wl_client *client,
|
|||
wl_resource_post_no_memory(resource);
|
||||
return;
|
||||
}
|
||||
wlr_data_source_init(source);
|
||||
|
||||
source->resource =
|
||||
wl_resource_create(client, &wl_data_source_interface,
|
||||
wl_resource_get_version(resource), id);
|
||||
source->resource = wl_resource_create(client, &wl_data_source_interface,
|
||||
wl_resource_get_version(resource), id);
|
||||
if (source->resource == NULL) {
|
||||
free(source);
|
||||
wl_resource_post_no_memory(resource);
|
||||
return;
|
||||
}
|
||||
wl_resource_set_implementation(source->resource, &data_source_impl,
|
||||
source, data_source_resource_destroy);
|
||||
|
||||
source->accept = client_data_source_accept;
|
||||
source->send = client_data_source_send;
|
||||
source->cancel = client_data_source_cancel;
|
||||
|
||||
wl_array_init(&source->mime_types);
|
||||
wl_signal_init(&source->events.destroy);
|
||||
|
||||
wl_resource_set_implementation(source->resource, &data_source_impl,
|
||||
source, data_source_resource_destroy);
|
||||
}
|
||||
|
||||
static const struct wl_data_device_manager_interface
|
||||
|
|
|
|||
|
|
@ -262,6 +262,12 @@ static void device_resource_handle_destroy(struct wl_resource *resource) {
|
|||
}
|
||||
|
||||
|
||||
void wlr_primary_selection_source_init(
|
||||
struct wlr_primary_selection_source *source) {
|
||||
wl_array_init(&source->mime_types);
|
||||
wl_signal_init(&source->events.destroy);
|
||||
}
|
||||
|
||||
static void device_manager_handle_create_source(struct wl_client *client,
|
||||
struct wl_resource *manager_resource, uint32_t id) {
|
||||
struct wlr_primary_selection_source *source =
|
||||
|
|
@ -270,6 +276,7 @@ static void device_manager_handle_create_source(struct wl_client *client,
|
|||
wl_client_post_no_memory(client);
|
||||
return;
|
||||
}
|
||||
wlr_primary_selection_source_init(source);
|
||||
|
||||
int version = wl_resource_get_version(manager_resource);
|
||||
source->resource = wl_resource_create(client,
|
||||
|
|
@ -284,9 +291,6 @@ static void device_manager_handle_create_source(struct wl_client *client,
|
|||
|
||||
source->send = client_source_send;
|
||||
source->cancel = client_source_cancel;
|
||||
|
||||
wl_array_init(&source->mime_types);
|
||||
wl_signal_init(&source->events.destroy);
|
||||
}
|
||||
|
||||
void device_manager_handle_get_device(struct wl_client *client,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue