1/*
2 * gdkdisplay-wayland.h
3 *
4 * Copyright 2001 Sun Microsystems Inc.
5 *
6 * Erwann Chenede <erwann.chenede@sun.com>
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
27#include <stdint.h>
28#include <wayland-client.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/keyboard-shortcuts-inhibit-unstable-v1-client-protocol.h>
36#include <gdk/wayland/server-decoration-client-protocol.h>
37#include <gdk/wayland/xdg-output-unstable-v1-client-protocol.h>
38#include <gdk/wayland/idle-inhibit-unstable-v1-client-protocol.h>
39#include <gdk/wayland/primary-selection-unstable-v1-client-protocol.h>
40#include <gdk/wayland/xdg-activation-v1-client-protocol.h>
41
42#include <glib.h>
43#include <gdk/gdkkeys.h>
44#include <gdk/gdksurface.h>
45#include <gdk/gdk.h> /* For gdk_get_program_class() */
46
47#include "gdkdisplayprivate.h"
48#include "gdkwaylanddevice.h"
49#include "cursor/wayland-cursor.h"
50
51#include <epoxy/egl.h>
52
53G_BEGIN_DECLS
54
55#define GDK_ZWP_POINTER_GESTURES_V1_VERSION 3
56
57typedef struct _GdkWaylandSelection GdkWaylandSelection;
58
59typedef struct {
60 gboolean antialias;
61 gboolean hinting;
62 int dpi;
63 const char *rgba;
64 const char *hintstyle;
65} GsdXftSettings;
66
67typedef enum _GdkWaylandShellVariant
68{
69 GDK_WAYLAND_SHELL_VARIANT_XDG_SHELL,
70 GDK_WAYLAND_SHELL_VARIANT_ZXDG_SHELL_V6
71} GdkWaylandShellVariant;
72
73struct _GdkWaylandDisplay
74{
75 GdkDisplay parent_instance;
76 GList *toplevels;
77
78 GHashTable *settings;
79 GsdXftSettings xft_settings;
80 GDBusProxy *settings_portal;
81
82 guint32 shell_capabilities;
83
84 /* Startup notification */
85 char *startup_notification_id;
86
87 /* Most recent serial */
88 guint32 serial;
89
90 uint32_t xdg_wm_base_id;
91 int xdg_wm_base_version;
92 uint32_t zxdg_shell_v6_id;
93 GdkWaylandShellVariant shell_variant;
94
95 /* Wayland fields below */
96 struct wl_display *wl_display;
97 struct wl_registry *wl_registry;
98 struct wl_compositor *compositor;
99 struct wl_shm *shm;
100 struct xdg_wm_base *xdg_wm_base;
101 struct zxdg_shell_v6 *zxdg_shell_v6;
102 struct gtk_shell1 *gtk_shell;
103 struct wl_input_device *input_device;
104 struct wl_data_device_manager *data_device_manager;
105 struct wl_subcompositor *subcompositor;
106 struct zwp_pointer_gestures_v1 *pointer_gestures;
107 struct zwp_primary_selection_device_manager_v1 *primary_selection_manager;
108 struct zwp_tablet_manager_v2 *tablet_manager;
109 struct zxdg_exporter_v1 *xdg_exporter;
110 struct zxdg_importer_v1 *xdg_importer;
111 struct zwp_keyboard_shortcuts_inhibit_manager_v1 *keyboard_shortcuts_inhibit;
112 struct org_kde_kwin_server_decoration_manager *server_decoration_manager;
113 struct zxdg_output_manager_v1 *xdg_output_manager;
114 struct zwp_idle_inhibit_manager_v1 *idle_inhibit_manager;
115 struct xdg_activation_v1 *xdg_activation;
116
117 GList *async_roundtrips;
118
119 /* Keep track of the ID's of the known globals and their corresponding
120 * names. This way we can check whether an interface is known, and
121 * remove globals given its ID. This table is not expected to be very
122 * large, meaning the lookup by interface name time is insignificant. */
123 GHashTable *known_globals;
124 GList *on_has_globals_closures;
125
126 GList *event_queues;
127
128 GList *current_popups;
129 GList *current_grabbing_popups;
130
131 struct wl_cursor_theme *cursor_theme;
132 char *cursor_theme_name;
133 int cursor_theme_size;
134 GHashTable *cursor_surface_cache;
135
136 GSource *event_source;
137
138 int compositor_version;
139 int seat_version;
140 int data_device_manager_version;
141 int gtk_shell_version;
142 int xdg_output_manager_version;
143 int pointer_gestures_version;
144 int xdg_activation_version;
145
146 uint32_t server_decoration_mode;
147
148 struct xkb_context *xkb_context;
149
150 GListStore *monitors;
151
152 gint64 last_bell_time_ms;
153};
154
155struct _GdkWaylandDisplayClass
156{
157 GdkDisplayClass parent_class;
158};
159
160gboolean gdk_wayland_display_prefers_ssd (GdkDisplay *display);
161
162G_END_DECLS
163
164#endif /* __GDK_WAYLAND_DISPLAY__ */
165

source code of gtk/gdk/wayland/gdkdisplay-wayland.h