1 /* wl-clipboard
2  *
3  * Copyright © 2019 Sergey Bugaev <bugaevc@gmail.com>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef TYPES_REGISTRY_H
20 #define TYPES_REGISTRY_H
21 
22 #include "includes/shell-protocols.h"
23 #include "includes/selection-protocols.h"
24 
25 #include <wayland-client.h>
26 
27 struct shell;
28 struct device_manager;
29 struct seat;
30 
31 struct registry {
32     /* This field is initialized by the creator */
33     struct wl_display *wl_display;
34 
35     /* These fields are initialized by the implementation */
36 
37     struct wl_registry *proxy;
38     struct wl_array seats;
39 
40     struct wl_compositor *wl_compositor;
41     struct wl_shm *wl_shm;
42 
43     /* Shells */
44 
45     struct wl_shell *wl_shell;
46 #ifdef HAVE_XDG_SHELL
47     struct xdg_wm_base *xdg_wm_base;
48 #endif
49 
50     /* Device managers */
51 
52     struct wl_data_device_manager *wl_data_device_manager;
53 #ifdef HAVE_GTK_PRIMARY_SELECTION
54     struct gtk_primary_selection_device_manager
55         *gtk_primary_selection_device_manager;
56 #endif
57 #ifdef HAVE_WP_PRIMARY_SELECTION
58     struct zwp_primary_selection_device_manager_v1
59         *zwp_primary_selection_device_manager_v1;
60 #endif
61 #ifdef HAVE_WLR_DATA_CONTROL
62     struct zwlr_data_control_manager_v1
63         *zwlr_data_control_manager_v1;
64 #endif
65 };
66 
67 void registry_init(struct registry *self);
68 
69 struct shell *registry_find_shell(struct registry *self);
70 
71 struct device_manager *registry_find_device_manager(
72     struct registry *self,
73     int primary
74 );
75 
76 struct seat *registry_find_seat(
77     struct registry *self,
78     const char *name
79 );
80 
81 #endif /* TYPES_REGISTRY_H */
82