Debian Codegraph @

gdk/wayland/gdkdisplay-wayland.h

raw
1 /*
2 * gdkdisplay-wayland.h
3 *
4 * Copyright 2001 Sun Microsystems Inc.
5 *
6 * Erwann Chenede <[email protected]>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
17 *
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 #ifndef __GDK_WAYLAND_DISPLAY__
23 #define __GDK_WAYLAND_DISPLAY__
24
25 #include <config.h>
26 #include <stdint.h>
27 #include <wayland-client.h>
28 #include <wayland-cursor.h>
29 #include <wayland-egl.h>
30 #include <gdk/wayland/tablet-unstable-v2-client-protocol.h>
31 #include <gdk/wayland/gtk-shell-client-protocol.h>
32 #include <gdk/wayland/xdg-shell-client-protocol.h>
33 #include <gdk/wayland/xdg-shell-unstable-v6-client-protocol.h>
34 #include <gdk/wayland/xdg-foreign-unstable-v1-client-protocol.h>
35 #include <gdk/wayland/xdg-foreign-unstable-v2-client-protocol.h>
36 #include <gdk/wayland/keyboard-shortcuts-inhibit-unstable-v1-client-protocol.h>
37 #include <gdk/wayland/server-decoration-client-protocol.h>
38 #include <gdk/wayland/xdg-output-unstable-v1-client-protocol.h>
39 #include <gdk/wayland/primary-selection-unstable-v1-client-protocol.h>
40 #ifdef HAVE_XDG_ACTIVATION
41 #include <gdk/wayland/xdg-activation-v1-client-protocol.h>
42 #endif
43 #include <gdk/wayland/cursor-shape-v1-client-protocol.h>
44
45 #include <glib.h>
46 #include <gdk/gdkkeys.h>
47 #include <gdk/gdkwindow.h>
48 #include <gdk/gdkinternals.h>
49 #include <gdk/gdk.h> /* For gdk_get_program_class() */
50
51 #include "gdkdisplayprivate.h"
52
53 #include <epoxy/egl.h>
54
55 G_BEGIN_DECLS
56
57 #define GDK_WAYLAND_MAX_THEME_SCALE 4
58 #define GDK_WAYLAND_THEME_SCALES_COUNT GDK_WAYLAND_MAX_THEME_SCALE
59
60 #define GDK_ZWP_POINTER_GESTURES_V1_VERSION 1
61
62 typedef struct _GdkWaylandSelection GdkWaylandSelection;
63
64 typedef enum _GdkWaylandShellVariant
65 {
66 GDK_WAYLAND_SHELL_VARIANT_XDG_SHELL,
67 GDK_WAYLAND_SHELL_VARIANT_ZXDG_SHELL_V6,
68 } GdkWaylandShellVariant;
69
70 struct _GdkWaylandDisplay
71 {
72 GdkDisplay parent_instance;
73 GdkScreen *screen;
74
75 /* Startup notification */
76 gchar *startup_notification_id;
77
78 /* Most recent serial */
79 guint32 serial;
80
81 uint32_t xdg_wm_base_id;
82 int xdg_wm_base_version;
83 uint32_t zxdg_shell_v6_id;
84 GdkWaylandShellVariant shell_variant;
85
86 /* Wayland fields below */
87 struct wl_display *wl_display;
88 struct wl_registry *wl_registry;
89 struct wl_compositor *compositor;
90 struct wl_shm *shm;
91 struct xdg_wm_base *xdg_wm_base;
92 struct zxdg_shell_v6 *zxdg_shell_v6;
93 struct gtk_shell1 *gtk_shell;
94 struct wl_input_device *input_device;
95 struct wl_data_device_manager *data_device_manager;
96 struct wl_subcompositor *subcompositor;
97 struct zwp_pointer_gestures_v1 *pointer_gestures;
98 struct gtk_primary_selection_device_manager *gtk_primary_selection_manager;
99 struct zwp_primary_selection_device_manager_v1 *zwp_primary_selection_manager_v1;
100 struct zwp_tablet_manager_v2 *tablet_manager;
101 struct zxdg_exporter_v1 *xdg_exporter_v1;
102 struct zxdg_importer_v1 *xdg_importer_v1;
103 struct zxdg_exporter_v2 *xdg_exporter_v2;
104 struct zxdg_importer_v2 *xdg_importer_v2;
105 struct zwp_keyboard_shortcuts_inhibit_manager_v1 *keyboard_shortcuts_inhibit;
106 struct org_kde_kwin_server_decoration_manager *server_decoration_manager;
107 struct zxdg_output_manager_v1 *xdg_output_manager;
108 uint32_t xdg_output_version;
109 #ifdef HAVE_XDG_ACTIVATION
110 struct xdg_activation_v1 *xdg_activation;
111 #endif
112 struct wp_cursor_shape_manager_v1 *cursor_shape;
113
114 GList *async_roundtrips;
115
116 /* Keep track of the ID's of the known globals and their corresponding
117 * names. This way we can check whether an interface is known, and
118 * remove globals given its ID. This table is not expected to be very
119 * large, meaning the lookup by interface name time is insignificant. */
120 GHashTable *known_globals;
121 GList *on_has_globals_closures;
122
123 /* Keep a list of orphaned dialogs (i.e. without parent) */
124 GList *orphan_dialogs;
125
126 GList *current_popups;
127
128 struct wl_cursor_theme *scaled_cursor_themes[GDK_WAYLAND_THEME_SCALES_COUNT];
129 gchar *cursor_theme_name;
130 int cursor_theme_size;
131 GHashTable *cursor_cache;
132
133 GSource *event_source;
134
135 int compositor_version;
136 int seat_version;
137 int data_device_manager_version;
138 int gtk_shell_version;
139 int xdg_output_manager_version;
140 #ifdef HAVE_XDG_ACTIVATION
141 int xdg_activation_version;
142 #endif
143
144 uint32_t server_decoration_mode;
145
146 struct xkb_context *xkb_context;
147
148 GdkWaylandSelection *selection;
149
150 GPtrArray *monitors;
151
152 gint64 last_bell_time_ms;
153
154 /* egl info */
155 EGLDisplay egl_display;
156 int egl_major_version;
157 int egl_minor_version;
158
159 guint have_egl : 1;
160 guint have_egl_khr_create_context : 1;
161 guint have_egl_buffer_age : 1;
162 guint have_egl_swap_buffers_with_damage : 1;
163 guint have_egl_surfaceless_context : 1;
164 EGLint egl_min_swap_interval;
165 };
166
167 struct _GdkWaylandDisplayClass
168 {
169 GdkDisplayClass parent_class;
170 };
171
172 G_END_DECLS
173
174 #endif /* __GDK_WAYLAND_DISPLAY__ */