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#include <stdint.h>
27#include <wayland-client.h>
28#include <wayland-cursor.h>
29#include <wayland-egl.h>
30#include <gdk/wayland/tablet-unstable-v1-client-protocol.h>
31#include <gdk/wayland/gtk-shell-client-protocol.h>
32#include <gdk/wayland/xdg-shell-unstable-v5-client-protocol.h>
33
34#include <glib.h>
35#include <gdk/gdkkeys.h>
36#include <gdk/gdkwindow.h>
37#include <gdk/gdkinternals.h>
38#include <gdk/gdk.h> /* For gdk_get_program_class() */
39
40#include "gdkdisplayprivate.h"
41
42#include <epoxy/egl.h>
43
44G_BEGIN_DECLS
45
46#define GDK_WAYLAND_MAX_THEME_SCALE 2
47#define GDK_WAYLAND_THEME_SCALES_COUNT GDK_WAYLAND_MAX_THEME_SCALE
48
49#define GDK_ZWP_POINTER_GESTURES_V1_VERSION 1
50
51typedef struct _GdkWaylandSelection GdkWaylandSelection;
52
53struct _GdkWaylandDisplay
54{
55 GdkDisplay parent_instance;
56 GdkScreen *screen;
57
58 /* Startup notification */
59 gchar *startup_notification_id;
60
61 /* Most recent serial */
62 guint32 serial;
63
64 /* Wayland fields below */
65 struct wl_display *wl_display;
66 struct wl_registry *wl_registry;
67 struct wl_compositor *compositor;
68 struct wl_shm *shm;
69 struct xdg_shell *xdg_shell;
70 struct gtk_shell1 *gtk_shell;
71 struct wl_input_device *input_device;
72 struct wl_data_device_manager *data_device_manager;
73 struct wl_subcompositor *subcompositor;
74 struct zwp_pointer_gestures_v1 *pointer_gestures;
75 struct gtk_primary_selection_device_manager *primary_selection_manager;
76 struct zwp_tablet_manager_v1 *tablet_manager;
77
78 GList *async_roundtrips;
79
80 /* Keep track of the ID's of the known globals and their corresponding
81 * names. This way we can check whether an interface is known, and
82 * remove globals given its ID. This table is not expected to be very
83 * large, meaning the lookup by interface name time is insignificant. */
84 GHashTable *known_globals;
85 GList *on_has_globals_closures;
86
87 /* Keep a list of orphaned dialogs (i.e. without parent) */
88 GList *orphan_dialogs;
89
90 struct wl_cursor_theme *scaled_cursor_themes[GDK_WAYLAND_THEME_SCALES_COUNT];
91 gchar *cursor_theme_name;
92 int cursor_theme_size;
93 GHashTable *cursor_cache;
94
95 GSource *event_source;
96
97 int compositor_version;
98 int seat_version;
99 int data_device_manager_version;
100 int gtk_shell_version;
101
102 struct xkb_context *xkb_context;
103
104 GdkWaylandSelection *selection;
105
106 GPtrArray *monitors;
107
108 /* egl info */
109 EGLDisplay egl_display;
110 int egl_major_version;
111 int egl_minor_version;
112
113 guint have_egl : 1;
114 guint have_egl_khr_create_context : 1;
115 guint have_egl_buffer_age : 1;
116 guint have_egl_swap_buffers_with_damage : 1;
117 guint have_egl_surfaceless_context : 1;
118};
119
120struct _GdkWaylandDisplayClass
121{
122 GdkDisplayClass parent_class;
123};
124
125G_END_DECLS
126
127#endif /* __GDK_WAYLAND_DISPLAY__ */
128