Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Commit

Permalink
primary-selection-v1: copy from gtk-primary-selection
Browse files Browse the repository at this point in the history
  • Loading branch information
emersion committed Feb 13, 2019
1 parent 5c8d2da commit 8163f7e
Show file tree
Hide file tree
Showing 8 changed files with 561 additions and 3 deletions.
1 change: 1 addition & 0 deletions include/wlr/types/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ install_headers(
'wlr_pointer_gestures_v1.h',
'wlr_pointer.h',
'wlr_presentation_time.h',
'wlr_primary_selection_v1.h',
'wlr_primary_selection.h',
'wlr_region.h',
'wlr_relative_pointer_v1.h',
Expand Down
52 changes: 52 additions & 0 deletions include/wlr/types/wlr_primary_selection_v1.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif

#ifndef WLR_TYPES_WLR_PRIMARY_SELECTION_V1_H
#define WLR_TYPES_WLR_PRIMARY_SELECTION_V1_H

#include <wayland-server.h>
#include <wlr/types/wlr_seat.h>

struct wlr_primary_selection_v1_device_manager {
struct wl_global *global;
struct wl_list resources; // wl_resource_get_link
struct wl_list devices; // wlr_primary_selection_v1_device::link

struct wl_listener display_destroy;

struct {
struct wl_signal destroy;
} events;

void *data;
};

/**
* A device is a per-seat object used to set and get the current selection.
*/
struct wlr_primary_selection_v1_device {
struct wlr_primary_selection_v1_device_manager *manager;
struct wlr_seat *seat;
struct wl_list link; // wlr_primary_selection_v1_device_manager::devices
struct wl_list resources; // wl_resource_get_link

struct wl_list offers; // wl_resource_get_link

struct wl_listener seat_destroy;
struct wl_listener seat_focus_change;
struct wl_listener seat_set_primary_selection;

void *data;
};

struct wlr_primary_selection_v1_device_manager *
wlr_primary_selection_v1_device_manager_create(struct wl_display *display);
void wlr_primary_selection_v1_device_manager_destroy(
struct wlr_primary_selection_v1_device_manager *manager);

#endif
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ add_project_arguments('-DWL_HIDE_DEPRECATED', language: 'c')
wayland_server = dependency('wayland-server', version: '>=1.16')
wayland_client = dependency('wayland-client')
wayland_egl = dependency('wayland-egl')
wayland_protos = dependency('wayland-protocols', version: '>=1.16')
wayland_protos = dependency('wayland-protocols', version: '>=1.17')
egl = dependency('egl')
glesv2 = dependency('glesv2')
drm = dependency('libdrm', version: '>=2.4.95')
Expand Down
1 change: 1 addition & 0 deletions protocol/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ protocols = [
[wl_protocol_dir, 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml'],
[wl_protocol_dir, 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml'],
[wl_protocol_dir, 'unstable/pointer-gestures/pointer-gestures-unstable-v1.xml'],
[wl_protocol_dir, 'unstable/primary-selection/primary-selection-unstable-v1.xml'],
[wl_protocol_dir, 'unstable/relative-pointer/relative-pointer-unstable-v1.xml'],
[wl_protocol_dir, 'unstable/tablet/tablet-unstable-v2.xml'],
[wl_protocol_dir, 'unstable/text-input/text-input-unstable-v3.xml'],
Expand Down
2 changes: 2 additions & 0 deletions rootston/desktop.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <wlr/types/wlr_layer_shell_v1.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_pointer_constraints_v1.h>
#include <wlr/types/wlr_primary_selection_v1.h>
#include <wlr/types/wlr_server_decoration.h>
#include <wlr/types/wlr_tablet_v2.h>
#include <wlr/types/wlr_wl_shell.h>
Expand Down Expand Up @@ -1087,6 +1088,7 @@ struct roots_desktop *desktop_create(struct roots_server *server,
desktop->pointer_gestures =
wlr_pointer_gestures_v1_create(server->wl_display);

wlr_primary_selection_v1_device_manager_create(server->wl_display);
wlr_data_control_manager_v1_create(server->wl_display);

return desktop;
Expand Down
1 change: 1 addition & 0 deletions types/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ lib_wlr_types = static_library(
'wlr_pointer_gestures_v1.c',
'wlr_pointer.c',
'wlr_presentation_time.c',
'wlr_primary_selection_v1.c',
'wlr_primary_selection.c',
'wlr_region.c',
'wlr_relative_pointer_v1.c',
Expand Down
4 changes: 2 additions & 2 deletions types/wlr_gtk_primary_selection.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ static void device_destroy(struct wlr_gtk_primary_selection_device *device) {
static const struct gtk_primary_selection_device_manager_interface
device_manager_impl;

struct wlr_gtk_primary_selection_device_manager *manager_from_resource(
static struct wlr_gtk_primary_selection_device_manager *manager_from_resource(
struct wl_resource *resource) {
assert(wl_resource_instance_of(resource,
&gtk_primary_selection_device_manager_interface, &device_manager_impl));
Expand Down Expand Up @@ -387,7 +387,7 @@ static void device_manager_handle_create_source(struct wl_client *client,
source_resource_handle_destroy);
}

void device_manager_handle_get_device(struct wl_client *client,
static void device_manager_handle_get_device(struct wl_client *client,
struct wl_resource *manager_resource, uint32_t id,
struct wl_resource *seat_resource) {
struct wlr_seat_client *seat_client =
Expand Down
Loading

0 comments on commit 8163f7e

Please sign in to comment.