1/* GDK - The GIMP Drawing Kit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18/*
19 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
20 * file for a list of people on the GTK+ Team. See the ChangeLog
21 * files for a list of changes. These files are distributed with
22 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23 */
24
25/*
26 * Private uninstalled header defining things local to the Wayland backend
27 */
28
29#ifndef __GDK_PRIVATE_WAYLAND_H__
30#define __GDK_PRIVATE_WAYLAND_H__
31
32#include <gdk/gdkcursor.h>
33#include <gdk/gdkprivate.h>
34#include <gdk/wayland/gdkwayland.h>
35#include <gdk/wayland/gdkdisplay-wayland.h>
36
37#include <xkbcommon/xkbcommon.h>
38
39#include "gdkinternals.h"
40#include "wayland/gtk-primary-selection-client-protocol.h"
41
42#include "config.h"
43
44#define WL_SURFACE_HAS_BUFFER_SCALE 3
45#define WL_POINTER_HAS_FRAME 5
46
47#define GDK_WINDOW_IS_WAYLAND(win) (GDK_IS_WINDOW_IMPL_WAYLAND (((GdkWindow *)win)->impl))
48
49GdkKeymap *_gdk_wayland_keymap_new (void);
50void _gdk_wayland_keymap_update_from_fd (GdkKeymap *keymap,
51 uint32_t format,
52 uint32_t fd,
53 uint32_t size);
54struct xkb_state *_gdk_wayland_keymap_get_xkb_state (GdkKeymap *keymap);
55struct xkb_keymap *_gdk_wayland_keymap_get_xkb_keymap (GdkKeymap *keymap);
56gboolean _gdk_wayland_keymap_key_is_modifier (GdkKeymap *keymap,
57 guint keycode);
58
59void _gdk_wayland_display_init_cursors (GdkWaylandDisplay *display);
60void _gdk_wayland_display_finalize_cursors (GdkWaylandDisplay *display);
61void _gdk_wayland_display_update_cursors (GdkWaylandDisplay *display);
62
63struct wl_cursor_theme * _gdk_wayland_display_get_scaled_cursor_theme (GdkWaylandDisplay *display_wayland,
64 guint scale);
65
66GdkCursor *_gdk_wayland_display_get_cursor_for_type (GdkDisplay *display,
67 GdkCursorType cursor_type);
68GdkCursor *_gdk_wayland_display_get_cursor_for_type_with_scale (GdkDisplay *display,
69 GdkCursorType cursor_type,
70 guint scale);
71GdkCursor *_gdk_wayland_display_get_cursor_for_name (GdkDisplay *display,
72 const gchar *name);
73GdkCursor *_gdk_wayland_display_get_cursor_for_surface (GdkDisplay *display,
74 cairo_surface_t *surface,
75 gdouble x,
76 gdouble y);
77void _gdk_wayland_display_get_default_cursor_size (GdkDisplay *display,
78 guint *width,
79 guint *height);
80void _gdk_wayland_display_get_maximal_cursor_size (GdkDisplay *display,
81 guint *width,
82 guint *height);
83gboolean _gdk_wayland_display_supports_cursor_alpha (GdkDisplay *display);
84gboolean _gdk_wayland_display_supports_cursor_color (GdkDisplay *display);
85
86struct wl_buffer *_gdk_wayland_cursor_get_buffer (GdkCursor *cursor,
87 guint image_index,
88 int *hotspot_x,
89 int *hotspot_y,
90 int *w,
91 int *h,
92 int *scale);
93guint _gdk_wayland_cursor_get_next_image_index (GdkCursor *cursor,
94 guint current_image_index,
95 guint *next_image_delay);
96
97void _gdk_wayland_cursor_set_scale (GdkCursor *cursor,
98 guint scale);
99
100GdkDragProtocol _gdk_wayland_window_get_drag_protocol (GdkWindow *window,
101 GdkWindow **target);
102
103void _gdk_wayland_window_register_dnd (GdkWindow *window);
104GdkDragContext *_gdk_wayland_window_drag_begin (GdkWindow *window,
105 GdkDevice *device,
106 GList *targets,
107 gint x_root,
108 gint y_root);
109void _gdk_wayland_window_offset_next_wl_buffer (GdkWindow *window,
110 int x,
111 int y);
112GdkDragContext * _gdk_wayland_drop_context_new (GdkDisplay *display,
113 struct wl_data_device *data_device);
114void _gdk_wayland_drag_context_set_source_window (GdkDragContext *context,
115 GdkWindow *window);
116void _gdk_wayland_drag_context_set_dest_window (GdkDragContext *context,
117 GdkWindow *dest_window,
118 uint32_t serial);
119void _gdk_wayland_drag_context_emit_event (GdkDragContext *context,
120 GdkEventType type,
121 guint32 time_);
122void _gdk_wayland_drag_context_set_coords (GdkDragContext *context,
123 gdouble x,
124 gdouble y);
125
126void gdk_wayland_drag_context_set_action (GdkDragContext *context,
127 GdkDragAction action);
128
129GdkDragContext * gdk_wayland_drag_context_lookup_by_data_source (struct wl_data_source *source);
130GdkDragContext * gdk_wayland_drag_context_lookup_by_source_window (GdkWindow *window);
131struct wl_data_source * gdk_wayland_drag_context_get_data_source (GdkDragContext *context);
132
133void gdk_wayland_drop_context_update_targets (GdkDragContext *context);
134
135void _gdk_wayland_display_create_window_impl (GdkDisplay *display,
136 GdkWindow *window,
137 GdkWindow *real_parent,
138 GdkScreen *screen,
139 GdkEventMask event_mask,
140 GdkWindowAttr *attributes,
141 gint attributes_mask);
142
143GdkWindow *_gdk_wayland_display_get_selection_owner (GdkDisplay *display,
144 GdkAtom selection);
145gboolean _gdk_wayland_display_set_selection_owner (GdkDisplay *display,
146 GdkWindow *owner,
147 GdkAtom selection,
148 guint32 time,
149 gboolean send_event);
150void _gdk_wayland_display_send_selection_notify (GdkDisplay *dispay,
151 GdkWindow *requestor,
152 GdkAtom selection,
153 GdkAtom target,
154 GdkAtom property,
155 guint32 time);
156gint _gdk_wayland_display_get_selection_property (GdkDisplay *display,
157 GdkWindow *requestor,
158 guchar **data,
159 GdkAtom *ret_type,
160 gint *ret_format);
161void _gdk_wayland_display_convert_selection (GdkDisplay *display,
162 GdkWindow *requestor,
163 GdkAtom selection,
164 GdkAtom target,
165 guint32 time);
166gint _gdk_wayland_display_text_property_to_utf8_list (GdkDisplay *display,
167 GdkAtom encoding,
168 gint format,
169 const guchar *text,
170 gint length,
171 gchar ***list);
172gchar * _gdk_wayland_display_utf8_to_string_target (GdkDisplay *display,
173 const gchar *str);
174
175GdkDeviceManager *_gdk_wayland_device_manager_new (GdkDisplay *display);
176void _gdk_wayland_device_manager_add_seat (GdkDeviceManager *device_manager,
177 guint32 id,
178 struct wl_seat *seat);
179void _gdk_wayland_device_manager_remove_seat (GdkDeviceManager *device_manager,
180 guint32 id);
181
182GdkKeymap *_gdk_wayland_device_get_keymap (GdkDevice *device);
183uint32_t _gdk_wayland_device_get_implicit_grab_serial(GdkWaylandDevice *device,
184 const GdkEvent *event);
185uint32_t _gdk_wayland_seat_get_last_implicit_grab_serial (GdkSeat *seat,
186 GdkEventSequence **seqence);
187struct wl_data_device * gdk_wayland_device_get_data_device (GdkDevice *gdk_device);
188void gdk_wayland_device_set_selection (GdkDevice *gdk_device,
189 struct wl_data_source *source);
190
191void gdk_wayland_seat_set_primary (GdkSeat *seat,
192 struct gtk_primary_selection_source *source);
193
194GdkDragContext * gdk_wayland_device_get_drop_context (GdkDevice *gdk_device);
195
196void gdk_wayland_device_unset_touch_grab (GdkDevice *device,
197 GdkEventSequence *sequence);
198
199void _gdk_wayland_display_deliver_event (GdkDisplay *display, GdkEvent *event);
200GSource *_gdk_wayland_display_event_source_new (GdkDisplay *display);
201void _gdk_wayland_display_queue_events (GdkDisplay *display);
202
203GdkAppLaunchContext *_gdk_wayland_display_get_app_launch_context (GdkDisplay *display);
204
205GdkDisplay *_gdk_wayland_display_open (const gchar *display_name);
206
207GdkWindow *_gdk_wayland_screen_create_root_window (GdkScreen *screen,
208 int width,
209 int height);
210
211GdkScreen *_gdk_wayland_screen_new (GdkDisplay *display);
212void _gdk_wayland_screen_add_output (GdkScreen *screen,
213 guint32 id,
214 struct wl_output *output,
215 guint32 version);
216void _gdk_wayland_screen_remove_output (GdkScreen *screen,
217 guint32 id);
218int _gdk_wayland_screen_get_output_refresh_rate (GdkScreen *screen,
219 struct wl_output *output);
220guint32 _gdk_wayland_screen_get_output_scale (GdkScreen *screen,
221 struct wl_output *output);
222struct wl_output *_gdk_wayland_screen_get_wl_output (GdkScreen *screen,
223 gint monitor_num);
224
225void _gdk_wayland_screen_set_has_gtk_shell (GdkScreen *screen);
226
227void _gdk_wayland_window_set_grab_seat (GdkWindow *window,
228 GdkSeat *seat);
229
230guint32 _gdk_wayland_display_get_serial (GdkWaylandDisplay *display_wayland);
231void _gdk_wayland_display_update_serial (GdkWaylandDisplay *display_wayland,
232 guint32 serial);
233
234cairo_surface_t * _gdk_wayland_display_create_shm_surface (GdkWaylandDisplay *display,
235 int width,
236 int height,
237 guint scale);
238struct wl_buffer *_gdk_wayland_shm_surface_get_wl_buffer (cairo_surface_t *surface);
239gboolean _gdk_wayland_is_shm_surface (cairo_surface_t *surface);
240
241GdkWaylandSelection * gdk_wayland_display_get_selection (GdkDisplay *display);
242GdkWaylandSelection * gdk_wayland_selection_new (void);
243void gdk_wayland_selection_free (GdkWaylandSelection *selection);
244
245void gdk_wayland_selection_ensure_offer (GdkDisplay *display,
246 struct wl_data_offer *wl_offer);
247void gdk_wayland_selection_ensure_primary_offer (GdkDisplay *display,
248 struct gtk_primary_selection_offer *wp_offer);
249
250void gdk_wayland_selection_set_offer (GdkDisplay *display,
251 GdkAtom selection,
252 gpointer offer);
253gpointer gdk_wayland_selection_get_offer (GdkDisplay *display,
254 GdkAtom selection);
255GList * gdk_wayland_selection_get_targets (GdkDisplay *display,
256 GdkAtom selection);
257
258void gdk_wayland_selection_store (GdkWindow *window,
259 GdkAtom type,
260 GdkPropMode mode,
261 const guchar *data,
262 gint len);
263struct wl_data_source * gdk_wayland_selection_get_data_source (GdkWindow *owner,
264 GdkAtom selection);
265void gdk_wayland_selection_unset_data_source (GdkDisplay *display, GdkAtom selection);
266gboolean gdk_wayland_selection_set_current_offer_actions (GdkDisplay *display,
267 uint32_t actions);
268
269EGLSurface gdk_wayland_window_get_egl_surface (GdkWindow *window,
270 EGLConfig config);
271EGLSurface gdk_wayland_window_get_dummy_egl_surface (GdkWindow *window,
272 EGLConfig config);
273
274void gdk_wayland_seat_set_global_cursor (GdkSeat *seat,
275 GdkCursor *cursor);
276
277struct wl_output *gdk_wayland_window_get_wl_output (GdkWindow *window);
278
279#endif /* __GDK_PRIVATE_WAYLAND_H__ */
280