]> Pileus Git - ~andy/gtk/blob - gdk/wayland/gdkwindow-wayland.c
wayland: Use wayland-egl
[~andy/gtk] / gdk / wayland / gdkwindow-wayland.c
1 /*
2  * Copyright © 2010 Intel Corporation
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 License
6  * as published by the Free Software Foundation; either version 2 of
7  * the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful, but
10  * 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, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17  * 02111-1307, USA.
18  */
19
20 #include "config.h"
21
22 #include <netinet/in.h>
23 #include <unistd.h>
24
25 #include "gdk.h"
26 #include "gdkwayland.h"
27
28 #include "gdkwindow.h"
29 #include "gdkwindowimpl.h"
30 #include "gdkdisplay-wayland.h"
31 #include "gdkscreen-wayland.h"
32 #include "gdkprivate-wayland.h"
33 #include "gdkinternals.h"
34 #include "gdkwindow-wayland.h"
35 #include "gdkdeviceprivate.h"
36 #include "gdkdevice-wayland.h"
37 #include "gdkeventsource.h"
38
39 #include <stdlib.h>
40 #include <stdio.h>
41 #include <string.h>
42
43 #include <wayland-egl.h>
44
45 #define WINDOW_IS_TOPLEVEL_OR_FOREIGN(window) \
46   (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD &&   \
47    GDK_WINDOW_TYPE (window) != GDK_WINDOW_OFFSCREEN)
48
49 #define WINDOW_IS_TOPLEVEL(window)                   \
50   (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD &&   \
51    GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN && \
52    GDK_WINDOW_TYPE (window) != GDK_WINDOW_OFFSCREEN)
53
54 /* Return whether time1 is considered later than time2 as far as xserver
55  * time is concerned.  Accounts for wraparound.
56  */
57 #define XSERVER_TIME_IS_LATER(time1, time2)                        \
58   ( (( time1 > time2 ) && ( time1 - time2 < ((guint32)-1)/2 )) ||  \
59     (( time1 < time2 ) && ( time2 - time1 > ((guint32)-1)/2 ))     \
60   )
61
62 typedef struct _GdkWaylandWindow GdkWaylandWindow;
63 typedef struct _GdkWaylandWindowClass GdkWaylandWindowClass;
64
65 struct _GdkWaylandWindow {
66   GdkWindow parent;
67 };
68
69 struct _GdkWaylandWindowClass {
70   GdkWindowClass parent_class;
71 };
72
73 G_DEFINE_TYPE (GdkWaylandWindow, _gdk_wayland_window, GDK_TYPE_WINDOW)
74
75 static void
76 _gdk_wayland_window_class_init (GdkWaylandWindowClass *wayland_window_class)
77 {
78 }
79
80 static void
81 _gdk_wayland_window_init (GdkWaylandWindow *wayland_window)
82 {
83 }
84
85 #define GDK_TYPE_WINDOW_IMPL_WAYLAND              (_gdk_window_impl_wayland_get_type ())
86 #define GDK_WINDOW_IMPL_WAYLAND(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WINDOW_IMPL_WAYLAND, GdkWindowImplWayland))
87 #define GDK_WINDOW_IMPL_WAYLAND_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WINDOW_IMPL_WAYLAND, GdkWindowImplWaylandClass))
88 #define GDK_IS_WINDOW_IMPL_WAYLAND(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WINDOW_IMPL_WAYLAND))
89 #define GDK_IS_WINDOW_IMPL_WAYLAND_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WINDOW_IMPL_WAYLAND))
90 #define GDK_WINDOW_IMPL_WAYLAND_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WINDOW_IMPL_WAYLAND, GdkWindowImplWaylandClass))
91
92 typedef struct _GdkWindowImplWayland GdkWindowImplWayland;
93 typedef struct _GdkWindowImplWaylandClass GdkWindowImplWaylandClass;
94
95 struct _GdkWindowImplWayland
96 {
97   GdkWindowImpl parent_instance;
98
99   GdkWindow *wrapper;
100
101   GdkToplevelWayland *toplevel; /* Toplevel-specific information */
102   GdkCursor *cursor;
103   GHashTable *device_cursor;
104
105   gint8 toplevel_window_type;
106
107   struct wl_surface *surface;
108   unsigned int mapped : 1;
109
110   cairo_surface_t *cairo_surface;
111   cairo_surface_t *server_surface;
112   GLuint texture;
113 };
114
115 struct _GdkWindowImplWaylandClass
116 {
117   GdkWindowImplClass parent_class;
118 };
119
120 G_DEFINE_TYPE (GdkWindowImplWayland, _gdk_window_impl_wayland, GDK_TYPE_WINDOW_IMPL)
121
122 static void
123 _gdk_window_impl_wayland_init (GdkWindowImplWayland *impl)
124 {
125   impl->toplevel_window_type = -1;
126   impl->device_cursor = g_hash_table_new_full (NULL, NULL, NULL,
127                                                (GDestroyNotify) gdk_cursor_unref);
128 }
129
130 GdkToplevelWayland *
131 _gdk_wayland_window_get_toplevel (GdkWindow *window)
132 {
133   GdkWindowImplWayland *impl;
134
135   g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
136
137   if (!WINDOW_IS_TOPLEVEL (window))
138     return NULL;
139
140   impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
141
142   if (!impl->toplevel)
143     impl->toplevel = g_new0 (GdkToplevelWayland, 1);
144
145   return impl->toplevel;
146 }
147
148 /**
149  * _gdk_wayland_window_update_size:
150  * @drawable: a #GdkDrawableImplWayland.
151  * 
152  * Updates the state of the drawable (in particular the drawable's
153  * cairo surface) when its size has changed.
154  **/
155 void
156 _gdk_wayland_window_update_size (GdkWindow *window)
157 {
158   GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
159   GdkRectangle area;
160   cairo_region_t *region;
161
162   fprintf(stderr, "update size, window %p\n", impl->wrapper);
163
164   if (impl->cairo_surface)
165     {
166       cairo_surface_destroy (impl->cairo_surface);
167       impl->cairo_surface = NULL;
168     }
169
170   area.x = 0;
171   area.y = 0;
172   area.width = window->width;
173   area.height = window->height;
174
175   region = cairo_region_create_rectangle (&area);
176   _gdk_window_invalidate_for_expose (window, region);
177   cairo_region_destroy (region);
178 }
179
180 GdkWindow *
181 _gdk_wayland_screen_create_root_window (GdkScreen *screen,
182                                         int width, int height)
183 {
184   GdkWindow *window;
185   GdkWindowImplWayland *impl;
186
187   window = _gdk_display_create_window (gdk_screen_get_display (screen));
188   window->impl = g_object_new (GDK_TYPE_WINDOW_IMPL_WAYLAND, NULL);
189   window->impl_window = window;
190   window->visual = gdk_screen_get_system_visual (screen);
191
192   impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
193
194   impl->wrapper = GDK_WINDOW (window);
195
196   window->window_type = GDK_WINDOW_ROOT;
197   window->depth = 32;
198
199   window->x = 0;
200   window->y = 0;
201   window->abs_x = 0;
202   window->abs_y = 0;
203   window->width = width;
204   window->height = height;
205   window->viewable = TRUE;
206
207   /* see init_randr_support() in gdkscreen-wayland.c */
208   window->event_mask = GDK_STRUCTURE_MASK;
209
210   return window;
211 }
212
213 static const gchar *
214 get_default_title (void)
215 {
216   const char *title;
217
218   title = g_get_application_name ();
219   if (!title)
220     title = g_get_prgname ();
221   if (!title)
222     title = "";
223
224   return title;
225 }
226
227 void
228 _gdk_wayland_display_create_window_impl (GdkDisplay    *display,
229                                          GdkWindow     *window,
230                                          GdkWindow     *real_parent,
231                                          GdkScreen     *screen,
232                                          GdkEventMask   event_mask,
233                                          GdkWindowAttr *attributes,
234                                          gint           attributes_mask)
235 {
236   GdkWindowImplWayland *impl;
237   const char *title;
238
239   impl = g_object_new (GDK_TYPE_WINDOW_IMPL_WAYLAND, NULL);
240   window->impl = GDK_WINDOW_IMPL (impl);
241   impl->wrapper = GDK_WINDOW (window);
242
243   printf("impl_new for window %p: %p\n", window, impl);
244
245   if (window->width > 65535 ||
246       window->height > 65535)
247     {
248       g_warning ("Native Windows wider or taller than 65535 pixels are not supported");
249
250       if (window->width > 65535)
251         window->width = 65535;
252       if (window->height > 65535)
253         window->height = 65535;
254     }
255
256   g_object_ref (window);
257
258   switch (GDK_WINDOW_TYPE (window))
259     {
260     case GDK_WINDOW_TOPLEVEL:
261     case GDK_WINDOW_TEMP:
262       if (attributes_mask & GDK_WA_TITLE)
263         title = attributes->title;
264       else
265         title = get_default_title ();
266
267       gdk_window_set_title (window, title);
268       break;
269
270     case GDK_WINDOW_CHILD:
271     default:
272       break;
273     }
274
275   if (attributes_mask & GDK_WA_TYPE_HINT)
276     gdk_window_set_type_hint (window, attributes->type_hint);
277 }
278
279 static void
280 gdk_toplevel_wayland_free_contents (GdkDisplay *display,
281                                 GdkToplevelWayland *toplevel)
282 {
283   if (toplevel->icon_pixmap)
284     {
285       cairo_surface_destroy (toplevel->icon_pixmap);
286       toplevel->icon_pixmap = NULL;
287     }
288   if (toplevel->icon_mask)
289     {
290       cairo_surface_destroy (toplevel->icon_mask);
291       toplevel->icon_mask = NULL;
292     }
293 }
294
295 static const cairo_user_data_key_t gdk_wayland_cairo_key;
296
297 typedef struct _GdkWaylandCairoSurfaceData {
298   EGLImageKHR image;
299   GLuint texture;
300   struct wl_egl_pixmap *pixmap;
301   struct wl_buffer *buffer;
302   GdkDisplayWayland *display;
303 } GdkWaylandCairoSurfaceData;
304
305 struct wl_buffer *
306 _gdk_wayland_surface_get_buffer (GdkDisplayWayland *display,
307                                  cairo_surface_t *surface)
308 {
309   GdkWaylandCairoSurfaceData *data;
310
311   data = cairo_surface_get_user_data (surface, &gdk_wayland_cairo_key);
312
313   if (!data->buffer)
314     data->buffer =
315       wl_egl_pixmap_create_buffer(display->native_display, data->pixmap);
316
317   return data->buffer;
318 }
319
320 static void
321 gdk_wayland_window_attach_image (GdkWindow *window)
322 {
323   GdkDisplayWayland *display_wayland =
324     GDK_DISPLAY_WAYLAND (gdk_window_get_display (window));
325   GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
326   struct wl_buffer *buffer;
327
328   if (GDK_WINDOW_DESTROYED (window))
329     return;
330
331   if (impl->server_surface == impl->cairo_surface)
332     return;
333
334   impl->server_surface = impl->cairo_surface;
335   buffer = _gdk_wayland_surface_get_buffer (display_wayland,
336                                             impl->cairo_surface);
337   wl_surface_attach (impl->surface, buffer, 0, 0);
338
339   fprintf(stderr, "attach %p %dx%d\n", window, window->width, window->height);
340 }
341
342 static void
343 gdk_window_impl_wayland_finalize (GObject *object)
344 {
345   GdkWindowImplWayland *impl;
346
347   g_return_if_fail (GDK_IS_WINDOW_IMPL_WAYLAND (object));
348
349   impl = GDK_WINDOW_IMPL_WAYLAND (object);
350
351   g_free (impl->toplevel);
352
353   if (impl->cursor)
354     gdk_cursor_unref (impl->cursor);
355
356   g_hash_table_destroy (impl->device_cursor);
357
358   G_OBJECT_CLASS (_gdk_window_impl_wayland_parent_class)->finalize (object);
359 }
360
361 static void
362 gdk_wayland_cairo_surface_destroy (void *p)
363 {
364   GdkWaylandCairoSurfaceData *data = p;
365
366   data->display->destroy_image (data->display->egl_display, data->image);
367   cairo_device_acquire(data->display->cairo_device);
368   glDeleteTextures(1, &data->texture);
369   cairo_device_release(data->display->cairo_device);
370   if (data->buffer)
371     wl_buffer_destroy(data->buffer);
372   g_free(data);
373 }
374
375 static cairo_surface_t *
376 gdk_wayland_create_cairo_surface (GdkDisplayWayland *display,
377                                   int width, int height)
378 {
379   GdkWaylandCairoSurfaceData *data;
380   cairo_surface_t *surface;
381   struct wl_visual *visual;
382
383   data = g_new (GdkWaylandCairoSurfaceData, 1);
384   data->display = display;
385   data->buffer = NULL;
386   visual = wl_display_get_premultiplied_argb_visual(display->wl_display);
387   data->pixmap =
388     wl_egl_pixmap_create(display->native_display, width, height, visual, 0);
389   data->image =
390     display->create_image(display->egl_display, NULL, EGL_NATIVE_PIXMAP_KHR,
391                           (EGLClientBuffer) data->pixmap, NULL);
392
393   glGenTextures(1, &data->texture);
394   glBindTexture(GL_TEXTURE_2D, data->texture);
395   display->image_target_texture_2d(GL_TEXTURE_2D, data->image);
396
397   printf("allocate image %dx%d (image %p)\n", width, height, data->image);
398
399   surface = cairo_gl_surface_create_for_texture(display->cairo_device,
400                                                 CAIRO_CONTENT_COLOR_ALPHA,
401                                                 data->texture, width, height);
402
403   cairo_surface_set_user_data (surface, &gdk_wayland_cairo_key,
404                                data, gdk_wayland_cairo_surface_destroy);
405
406   if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS)
407     fprintf (stderr, "create gl surface failed\n");
408
409   return surface;
410 }
411
412 static cairo_surface_t *
413 gdk_wayland_window_ref_cairo_surface (GdkWindow *window)
414 {
415   GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
416   GdkDisplayWayland *display_wayland =
417     GDK_DISPLAY_WAYLAND (gdk_window_get_display (impl->wrapper));
418
419   if (GDK_WINDOW_DESTROYED (impl->wrapper))
420     return NULL;
421
422   if (!impl->cairo_surface)
423     {
424       impl->cairo_surface =
425         gdk_wayland_create_cairo_surface (display_wayland,
426                                       impl->wrapper->width,
427                                       impl->wrapper->height);
428     }
429
430   cairo_surface_reference (impl->cairo_surface);
431
432   return impl->cairo_surface;
433 }
434
435 static void
436 gdk_wayland_window_set_user_time (GdkWindow *window, guint32 user_time)
437 {
438 }
439
440 static void
441 gdk_wayland_window_show (GdkWindow *window, gboolean already_mapped)
442 {
443   GdkDisplay *display;
444   GdkDisplayWayland *display_wayland;
445   GdkToplevelWayland *toplevel;
446   GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
447
448   display = gdk_window_get_display (window);
449   display_wayland = GDK_DISPLAY_WAYLAND (display);
450
451   if (WINDOW_IS_TOPLEVEL (window))
452     {
453       toplevel = _gdk_wayland_window_get_toplevel (window);
454
455       if (toplevel->user_time != 0 &&
456               display_wayland->user_time != 0 &&
457           XSERVER_TIME_IS_LATER (display_wayland->user_time, toplevel->user_time))
458         gdk_wayland_window_set_user_time (window, display_wayland->user_time);
459     }
460
461   impl->surface = wl_compositor_create_surface(display_wayland->compositor);
462   wl_surface_set_user_data(impl->surface, window);
463
464   _gdk_make_event (window, GDK_MAP, NULL, FALSE);
465
466   fprintf(stderr, "window show, faked map event\n");
467 }
468
469 static void
470 gdk_wayland_window_hide (GdkWindow *window)
471 {
472   GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
473
474   if (impl->surface)
475     {
476       fprintf (stderr, "hide surface %p\n", impl->surface);
477
478       wl_surface_destroy(impl->surface);
479       impl->surface = NULL;
480     }
481
482   _gdk_window_clear_update_area (window);
483 }
484
485 static void
486 gdk_window_wayland_withdraw (GdkWindow *window)
487 {
488   GdkWindowImplWayland *impl;
489
490   if (!window->destroyed)
491     {
492       if (GDK_WINDOW_IS_MAPPED (window))
493         gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_WITHDRAWN);
494
495       g_assert (!GDK_WINDOW_IS_MAPPED (window));
496
497       impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
498       if (impl->surface)
499         {
500           fprintf (stderr, "hide surface %p\n", impl->surface);
501
502           wl_surface_destroy(impl->surface);
503           impl->surface = NULL;
504           cairo_surface_destroy(GDK_WINDOW_IMPL_WAYLAND(impl)->cairo_surface);
505         }
506     }
507 }
508
509 static void
510 gdk_window_wayland_set_events (GdkWindow    *window,
511                                GdkEventMask  event_mask)
512 {
513   GDK_WINDOW (window)->event_mask = event_mask;
514 }
515
516 static GdkEventMask
517 gdk_window_wayland_get_events (GdkWindow *window)
518 {
519   if (GDK_WINDOW_DESTROYED (window))
520     return 0;
521   else
522     return GDK_WINDOW (window)->event_mask;
523 }
524
525 static void
526 gdk_window_wayland_raise (GdkWindow *window)
527 {
528   /* FIXME: wl_shell_raise() */
529 }
530
531 static void
532 gdk_window_wayland_lower (GdkWindow *window)
533 {
534   /* FIXME: wl_shell_lower() */
535 }
536
537 static void
538 gdk_window_wayland_restack_under (GdkWindow *window,
539                               GList *native_siblings)
540 {
541 }
542
543 static void
544 gdk_window_wayland_restack_toplevel (GdkWindow *window,
545                                  GdkWindow *sibling,
546                                  gboolean   above)
547 {
548 }
549
550 static void
551 gdk_window_wayland_move_resize (GdkWindow *window,
552                                 gboolean   with_move,
553                                 gint       x,
554                                 gint       y,
555                                 gint       width,
556                                 gint       height)
557 {
558   window->x = x;
559   window->y = y;
560   if (width > 0)
561     window->width = width;
562   if (height > 0)
563     window->height = height;
564
565   _gdk_wayland_window_update_size (window);
566 }
567
568 static void
569 gdk_window_wayland_set_background (GdkWindow      *window,
570                                cairo_pattern_t *pattern)
571 {
572 }
573
574 static gboolean
575 gdk_window_wayland_reparent (GdkWindow *window,
576                              GdkWindow *new_parent,
577                              gint       x,
578                              gint       y)
579 {
580   return FALSE;
581 }
582
583 static void
584 gdk_window_wayland_set_device_cursor (GdkWindow *window,
585                                       GdkDevice *device,
586                                       GdkCursor *cursor)
587 {
588   GdkWindowImplWayland *impl;
589
590   g_return_if_fail (GDK_IS_WINDOW (window));
591   g_return_if_fail (GDK_IS_DEVICE (device));
592
593   impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
594
595   if (!cursor)
596     g_hash_table_remove (impl->device_cursor, device);
597   else
598     {
599       g_hash_table_replace (impl->device_cursor,
600                             device, gdk_cursor_ref (cursor));
601     }
602
603   if (!GDK_WINDOW_DESTROYED (window))
604     GDK_DEVICE_GET_CLASS (device)->set_window_cursor (device, window, cursor);
605 }
606
607 static void
608 gdk_window_wayland_get_geometry (GdkWindow *window,
609                                  gint      *x,
610                                  gint      *y,
611                                  gint      *width,
612                                  gint      *height)
613 {
614   if (!GDK_WINDOW_DESTROYED (window))
615     {
616       if (x)
617         *x = window->x;
618       if (y)
619         *y = window->y;
620       if (width)
621         *width = window->width;
622       if (height)
623         *height = window->height;
624     }
625 }
626
627 static gint
628 gdk_window_wayland_get_root_coords (GdkWindow *window,
629                                 gint       x,
630                                 gint       y,
631                                 gint      *root_x,
632                                 gint      *root_y)
633 {
634   /* We can't do this. */
635   if (root_x)
636     *root_x = 0;
637   if (root_y)
638     *root_y = 0;
639
640   return 1;
641 }
642
643 static gboolean
644 gdk_window_wayland_get_device_state (GdkWindow       *window,
645                                      GdkDevice       *device,
646                                      gint            *x,
647                                      gint            *y,
648                                      GdkModifierType *mask)
649 {
650   gboolean return_val;
651
652   g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), FALSE);
653
654   return_val = TRUE;
655
656   if (!GDK_WINDOW_DESTROYED (window))
657     {
658       GdkWindow *child;
659
660       GDK_DEVICE_GET_CLASS (device)->query_state (device, window,
661                                                   NULL, &child,
662                                                   NULL, NULL,
663                                                   x, y, mask);
664       return_val = (child != NULL);
665     }
666
667   return return_val;
668 }
669
670 static void
671 gdk_window_wayland_shape_combine_region (GdkWindow       *window,
672                                          const cairo_region_t *shape_region,
673                                          gint             offset_x,
674                                          gint             offset_y)
675 {
676 }
677
678 static void 
679 gdk_window_wayland_input_shape_combine_region (GdkWindow       *window,
680                                                const cairo_region_t *shape_region,
681                                                gint             offset_x,
682                                                gint             offset_y)
683 {
684 }
685
686 static gboolean
687 gdk_window_wayland_set_static_gravities (GdkWindow *window,
688                                          gboolean   use_static)
689 {
690   return TRUE;
691 }
692
693 static gboolean
694 gdk_wayland_window_queue_antiexpose (GdkWindow *window,
695                                      cairo_region_t *area)
696 {
697   return FALSE;
698 }
699
700 static void
701 gdk_wayland_window_translate (GdkWindow      *window,
702                               cairo_region_t *area,
703                               gint            dx,
704                               gint            dy)
705 {
706   cairo_surface_t *surface;
707   cairo_t *cr;
708
709   surface = gdk_wayland_window_ref_cairo_surface (window->impl_window);
710   cr = cairo_create (surface);
711   cairo_surface_destroy (surface);
712
713   gdk_cairo_region (cr, area);
714   cairo_clip (cr);
715   cairo_set_source_surface (cr, cairo_get_target (cr), dx, dy);
716   cairo_push_group (cr);
717   cairo_paint (cr);
718   cairo_pop_group_to_source (cr);
719   cairo_paint (cr);
720   cairo_destroy (cr);
721 }
722
723 static void
724 gdk_wayland_window_destroy (GdkWindow *window,
725                             gboolean   recursing,
726                             gboolean   foreign_destroy)
727 {
728   GdkToplevelWayland *toplevel;
729   GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
730
731   g_return_if_fail (GDK_IS_WINDOW (window));
732
733   toplevel = _gdk_wayland_window_get_toplevel (window);
734   if (toplevel)
735     gdk_toplevel_wayland_free_contents (gdk_window_get_display (window),
736                                         toplevel);
737
738   if (impl->cairo_surface)
739     {
740       cairo_surface_finish (impl->cairo_surface);
741       cairo_surface_set_user_data (impl->cairo_surface, &gdk_wayland_cairo_key,
742                                    NULL, NULL);
743     }
744
745   if (impl->texture)
746     glDeleteTextures(1, &impl->texture);
747
748   if (!recursing && !foreign_destroy)
749     {
750       fprintf (stderr, "destroy window, surface %p\n",
751                GDK_WINDOW_IMPL_WAYLAND (window->impl)->surface);
752
753       if (GDK_WINDOW_IMPL_WAYLAND (window->impl)->surface)
754         wl_surface_destroy(GDK_WINDOW_IMPL_WAYLAND (window->impl)->surface);
755     }
756 }
757
758 static void
759 gdk_window_wayland_destroy_foreign (GdkWindow *window)
760 {
761 }
762
763 static cairo_surface_t *
764 gdk_window_wayland_resize_cairo_surface (GdkWindow       *window,
765                                          cairo_surface_t *surface,
766                                          gint             width,
767                                          gint             height)
768 {
769   return surface;
770 }
771
772 static cairo_region_t *
773 gdk_wayland_window_get_shape (GdkWindow *window)
774 {
775   return NULL;
776 }
777
778 static cairo_region_t *
779 gdk_wayland_window_get_input_shape (GdkWindow *window)
780 {
781   return NULL;
782 }
783
784 static void
785 gdk_wayland_window_focus (GdkWindow *window,
786                           guint32    timestamp)
787 {
788   /* FIXME: wl_shell_focus() */
789 }
790
791 static void
792 gdk_wayland_window_set_type_hint (GdkWindow        *window,
793                                   GdkWindowTypeHint hint)
794 {
795   if (GDK_WINDOW_DESTROYED (window))
796     return;
797
798   switch (hint)
799     {
800     case GDK_WINDOW_TYPE_HINT_DIALOG:
801     case GDK_WINDOW_TYPE_HINT_MENU:
802     case GDK_WINDOW_TYPE_HINT_TOOLBAR:
803     case GDK_WINDOW_TYPE_HINT_UTILITY:
804     case GDK_WINDOW_TYPE_HINT_SPLASHSCREEN:
805     case GDK_WINDOW_TYPE_HINT_DOCK:
806     case GDK_WINDOW_TYPE_HINT_DESKTOP:
807     case GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU:
808     case GDK_WINDOW_TYPE_HINT_POPUP_MENU:
809     case GDK_WINDOW_TYPE_HINT_TOOLTIP:
810     case GDK_WINDOW_TYPE_HINT_NOTIFICATION:
811     case GDK_WINDOW_TYPE_HINT_COMBO:
812     case GDK_WINDOW_TYPE_HINT_DND:
813       break;
814     default:
815       g_warning ("Unknown hint %d passed to gdk_window_set_type_hint", hint);
816       /* Fall thru */
817     case GDK_WINDOW_TYPE_HINT_NORMAL:
818       break;
819     }
820 }
821
822 static GdkWindowTypeHint
823 gdk_wayland_window_get_type_hint (GdkWindow *window)
824 {
825   return GDK_WINDOW_TYPE_HINT_NORMAL;
826 }
827
828 void
829 gdk_wayland_window_set_modal_hint (GdkWindow *window,
830                                    gboolean   modal)
831 {
832 }
833
834 static void
835 gdk_wayland_window_set_skip_taskbar_hint (GdkWindow *window,
836                                           gboolean   skips_taskbar)
837 {
838 }
839
840 static void
841 gdk_wayland_window_set_skip_pager_hint (GdkWindow *window,
842                                         gboolean   skips_pager)
843 {
844 }
845
846 static void
847 gdk_wayland_window_set_urgency_hint (GdkWindow *window,
848                                      gboolean   urgent)
849 {
850 }
851
852 static void
853 gdk_wayland_window_set_geometry_hints (GdkWindow         *window,
854                                        const GdkGeometry *geometry,
855                                        GdkWindowHints     geom_mask)
856 {
857   if (GDK_WINDOW_DESTROYED (window) ||
858       !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
859     return;
860
861   /*
862    * GDK_HINT_POS
863    * GDK_HINT_USER_POS
864    * GDK_HINT_USER_SIZE
865    * GDK_HINT_MIN_SIZE
866    * GDK_HINT_MAX_SIZE
867    * GDK_HINT_BASE_SIZE
868    * GDK_HINT_RESIZE_INC
869    * GDK_HINT_ASPECT
870    * GDK_HINT_WIN_GRAVITY
871    */
872 }
873
874 static void
875 gdk_wayland_window_set_title (GdkWindow   *window,
876                               const gchar *title)
877 {
878   g_return_if_fail (title != NULL);
879
880   if (GDK_WINDOW_DESTROYED (window))
881     return;
882 }
883
884 static void
885 gdk_wayland_window_set_role (GdkWindow   *window,
886                              const gchar *role)
887 {
888 }
889
890 static void
891 gdk_wayland_window_set_startup_id (GdkWindow   *window,
892                                    const gchar *startup_id)
893 {
894 }
895
896 static void
897 gdk_wayland_window_set_transient_for (GdkWindow *window,
898                                       GdkWindow *parent)
899 {
900 }
901
902 static void
903 gdk_wayland_window_get_root_origin (GdkWindow *window,
904                                    gint      *x,
905                                    gint      *y)
906 {
907   if (x)
908     *x = 0;
909
910   if (y)
911     *y = 0;
912 }
913
914 static void
915 gdk_wayland_window_get_frame_extents (GdkWindow    *window,
916                                       GdkRectangle *rect)
917 {
918   rect->x = window->x;
919   rect->y = window->y;
920   rect->width = window->width;
921   rect->height = window->height;
922 }
923
924 static void
925 gdk_wayland_window_set_override_redirect (GdkWindow *window,
926                                           gboolean override_redirect)
927 {
928 }
929
930 static void
931 gdk_wayland_window_set_accept_focus (GdkWindow *window,
932                                      gboolean accept_focus)
933 {
934 }
935
936 static void
937 gdk_wayland_window_set_focus_on_map (GdkWindow *window,
938                                      gboolean focus_on_map)
939 {
940   focus_on_map = focus_on_map != FALSE;
941
942   if (window->focus_on_map != focus_on_map)
943     {
944       window->focus_on_map = focus_on_map;
945
946       if ((!GDK_WINDOW_DESTROYED (window)) &&
947           (!window->focus_on_map) &&
948           WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
949         gdk_wayland_window_set_user_time (window, 0);
950     }
951 }
952
953 static void
954 gdk_wayland_window_set_icon_list (GdkWindow *window,
955                                   GList     *pixbufs)
956 {
957 }
958
959 static void
960 gdk_wayland_window_set_icon_name (GdkWindow   *window,
961                                   const gchar *name)
962 {
963   if (GDK_WINDOW_DESTROYED (window))
964     return;
965 }
966
967 static void
968 gdk_wayland_window_iconify (GdkWindow *window)
969 {
970 }
971
972 static void
973 gdk_wayland_window_deiconify (GdkWindow *window)
974 {
975   if (GDK_WINDOW_DESTROYED (window) ||
976       !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
977     return;
978
979   if (GDK_WINDOW_IS_MAPPED (window))
980     {  
981       gdk_window_show (window);
982     }
983   else
984     {
985       /* Flip our client side flag, the real work happens on map. */
986       gdk_synthesize_window_state (window, GDK_WINDOW_STATE_ICONIFIED, 0);
987     }
988 }
989
990 static void
991 gdk_wayland_window_stick (GdkWindow *window)
992 {
993   if (GDK_WINDOW_DESTROYED (window))
994     return;
995 }
996
997 static void
998 gdk_wayland_window_unstick (GdkWindow *window)
999 {
1000   if (GDK_WINDOW_DESTROYED (window))
1001     return;
1002 }
1003
1004 static void
1005 gdk_wayland_window_maximize (GdkWindow *window)
1006 {
1007   if (GDK_WINDOW_DESTROYED (window))
1008     return;
1009 }
1010
1011 static void
1012 gdk_wayland_window_unmaximize (GdkWindow *window)
1013 {
1014   if (GDK_WINDOW_DESTROYED (window))
1015     return;
1016 }
1017
1018 static void
1019 gdk_wayland_window_fullscreen (GdkWindow *window)
1020 {
1021   if (GDK_WINDOW_DESTROYED (window))
1022     return;
1023 }
1024
1025 static void
1026 gdk_wayland_window_unfullscreen (GdkWindow *window)
1027 {
1028   if (GDK_WINDOW_DESTROYED (window))
1029     return;
1030 }
1031
1032 static void
1033 gdk_wayland_window_set_keep_above (GdkWindow *window,
1034                                    gboolean   setting)
1035 {
1036   g_return_if_fail (GDK_IS_WINDOW (window));
1037
1038   if (GDK_WINDOW_DESTROYED (window))
1039     return;
1040 }
1041
1042 static void
1043 gdk_wayland_window_set_keep_below (GdkWindow *window, gboolean setting)
1044 {
1045   g_return_if_fail (GDK_IS_WINDOW (window));
1046
1047   if (GDK_WINDOW_DESTROYED (window))
1048     return;
1049 }
1050
1051 static GdkWindow *
1052 gdk_wayland_window_get_group (GdkWindow *window)
1053 {
1054   if (GDK_WINDOW_DESTROYED (window) ||
1055       !WINDOW_IS_TOPLEVEL (window))
1056     return NULL;
1057
1058   return NULL;
1059 }
1060
1061 static void
1062 gdk_wayland_window_set_group (GdkWindow *window,
1063                               GdkWindow *leader)
1064 {
1065   g_return_if_fail (GDK_IS_WINDOW (window));
1066   g_return_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD);
1067   g_return_if_fail (leader == NULL || GDK_IS_WINDOW (leader));
1068 }
1069
1070 static void
1071 gdk_wayland_window_set_decorations (GdkWindow      *window,
1072                                     GdkWMDecoration decorations)
1073 {
1074 }
1075
1076 static gboolean
1077 gdk_wayland_window_get_decorations (GdkWindow       *window,
1078                                     GdkWMDecoration *decorations)
1079 {
1080   return FALSE;
1081 }
1082
1083 static void
1084 gdk_wayland_window_set_functions (GdkWindow    *window,
1085                                   GdkWMFunction functions)
1086 {
1087 }
1088
1089 static void
1090 gdk_wayland_window_begin_resize_drag (GdkWindow     *window,
1091                                       GdkWindowEdge  edge,
1092                                       gint           button,
1093                                       gint           root_x,
1094                                       gint           root_y,
1095                                       guint32        timestamp)
1096 {
1097   GdkDisplay *display = gdk_window_get_display (window);
1098   GdkDeviceManager *dm;
1099   GdkWindowImplWayland *impl;
1100   GdkDevice *device;
1101   uint32_t grab_type;
1102
1103   if (GDK_WINDOW_DESTROYED (window) ||
1104       !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
1105     return;
1106
1107   switch (edge)
1108     {
1109     case GDK_WINDOW_EDGE_NORTH_WEST:
1110       grab_type = WL_SHELL_RESIZE_TOP_LEFT;
1111       break;
1112
1113     case GDK_WINDOW_EDGE_NORTH:
1114       grab_type = WL_SHELL_RESIZE_TOP;
1115       break;
1116
1117     case GDK_WINDOW_EDGE_NORTH_EAST:
1118       grab_type = WL_SHELL_RESIZE_RIGHT;
1119       break;
1120
1121     case GDK_WINDOW_EDGE_WEST:
1122       grab_type = WL_SHELL_RESIZE_LEFT;
1123       break;
1124
1125     case GDK_WINDOW_EDGE_EAST:
1126       grab_type = WL_SHELL_RESIZE_RIGHT;
1127       break;
1128
1129     case GDK_WINDOW_EDGE_SOUTH_WEST:
1130       grab_type = WL_SHELL_RESIZE_BOTTOM_LEFT;
1131       break;
1132
1133     case GDK_WINDOW_EDGE_SOUTH:
1134       grab_type = WL_SHELL_RESIZE_BOTTOM;
1135       break;
1136
1137     case GDK_WINDOW_EDGE_SOUTH_EAST:
1138       grab_type = WL_SHELL_RESIZE_BOTTOM_RIGHT;
1139       break;
1140
1141     default:
1142       g_warning ("gdk_window_begin_resize_drag: bad resize edge %d!",
1143                  edge);
1144       return;
1145     }
1146
1147   impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
1148   dm = gdk_display_get_device_manager (display);
1149   device = gdk_device_manager_get_client_pointer (dm);
1150
1151   wl_shell_resize(GDK_DISPLAY_WAYLAND (display)->shell, impl->surface,
1152                   GDK_DEVICE_CORE (device)->device->device,
1153                   timestamp, grab_type);
1154 }
1155
1156 static void
1157 gdk_wayland_window_begin_move_drag (GdkWindow *window,
1158                                     gint       button,
1159                                     gint       root_x,
1160                                     gint       root_y,
1161                                     guint32    timestamp)
1162 {
1163   GdkDisplay *display = gdk_window_get_display (window);
1164   GdkDeviceManager *dm;
1165   GdkWindowImplWayland *impl;
1166   GdkDevice *device;
1167
1168   if (GDK_WINDOW_DESTROYED (window) ||
1169       !WINDOW_IS_TOPLEVEL (window))
1170     return;
1171
1172   impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
1173
1174   dm = gdk_display_get_device_manager (display);
1175   device = gdk_device_manager_get_client_pointer (dm);
1176
1177   wl_shell_move(GDK_DISPLAY_WAYLAND (display)->shell, impl->surface,
1178                 GDK_DEVICE_CORE (device)->device->device, timestamp);
1179 }
1180
1181 static void
1182 gdk_wayland_window_enable_synchronized_configure (GdkWindow *window)
1183 {
1184 }
1185
1186 static void
1187 gdk_wayland_window_configure_finished (GdkWindow *window)
1188 {
1189   if (!WINDOW_IS_TOPLEVEL (window))
1190     return;
1191
1192   if (!GDK_IS_WINDOW_IMPL_WAYLAND (window->impl))
1193     return;
1194
1195   fprintf(stderr, "configure %p finished\n", window);
1196 }
1197
1198 static void
1199 gdk_wayland_window_set_opacity (GdkWindow *window,
1200                                 gdouble    opacity)
1201 {
1202 }
1203
1204 static void
1205 gdk_wayland_window_set_composited (GdkWindow *window,
1206                                    gboolean   composited)
1207 {
1208 }
1209
1210 static void
1211 gdk_wayland_window_destroy_notify (GdkWindow *window)
1212 {
1213   if (!GDK_WINDOW_DESTROYED (window))
1214     {
1215       if (GDK_WINDOW_TYPE(window) != GDK_WINDOW_FOREIGN)
1216         g_warning ("GdkWindow %p unexpectedly destroyed", window);
1217
1218       _gdk_window_destroy (window, TRUE);
1219     }
1220
1221   g_object_unref (window);
1222 }
1223
1224 static void
1225 gdk_wayland_window_process_updates_recurse (GdkWindow *window,
1226                                             cairo_region_t *region)
1227 {
1228   GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
1229   cairo_rectangle_int_t rect;
1230   int i, n;
1231
1232   gdk_wayland_window_attach_image (window);
1233   if (!impl->mapped)
1234     {
1235       wl_surface_map_toplevel (impl->surface);
1236       impl->mapped = TRUE;
1237     }
1238
1239   n = cairo_region_num_rectangles(region);
1240   for (i = 0; i < n; i++)
1241     {
1242       cairo_region_get_rectangle (region, i, &rect);
1243       wl_surface_damage (impl->surface,
1244                          rect.x, rect.y, rect.width, rect.height);
1245     }
1246
1247   _gdk_window_process_updates_recurse (window, region);
1248 }
1249
1250 static void
1251 gdk_wayland_window_sync_rendering (GdkWindow *window)
1252 {
1253 }
1254
1255 static gboolean
1256 gdk_wayland_window_simulate_key (GdkWindow      *window,
1257                                  gint            x,
1258                                  gint            y,
1259                                  guint           keyval,
1260                                  GdkModifierType modifiers,
1261                                  GdkEventType    key_pressrelease)
1262 {
1263   return FALSE;
1264 }
1265
1266 static gboolean
1267 gdk_wayland_window_simulate_button (GdkWindow      *window,
1268                                     gint            x,
1269                                     gint            y,
1270                                     guint           button, /*1..3*/
1271                                     GdkModifierType modifiers,
1272                                     GdkEventType    button_pressrelease)
1273 {
1274   return FALSE;
1275 }
1276
1277 static gboolean
1278 gdk_wayland_window_get_property (GdkWindow   *window,
1279                                  GdkAtom      property,
1280                                  GdkAtom      type,
1281                                  gulong       offset,
1282                                  gulong       length,
1283                                  gint         pdelete,
1284                                  GdkAtom     *actual_property_type,
1285                                  gint        *actual_format_type,
1286                                  gint        *actual_length,
1287                                  guchar     **data)
1288 {
1289   return FALSE;
1290 }
1291
1292 static void
1293 gdk_wayland_window_change_property (GdkWindow    *window,
1294                                     GdkAtom       property,
1295                                     GdkAtom       type,
1296                                     gint          format,
1297                                     GdkPropMode   mode,
1298                                     const guchar *data,
1299                                     gint          nelements)
1300 {
1301 }
1302
1303 static void
1304 gdk_wayland_window_delete_property (GdkWindow *window,
1305                                     GdkAtom    property)
1306 {
1307 }
1308
1309 static void
1310 _gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass)
1311 {
1312   GObjectClass *object_class = G_OBJECT_CLASS (klass);
1313   GdkWindowImplClass *impl_class = GDK_WINDOW_IMPL_CLASS (klass);
1314
1315   object_class->finalize = gdk_window_impl_wayland_finalize;
1316
1317   impl_class->ref_cairo_surface = gdk_wayland_window_ref_cairo_surface;
1318   impl_class->show = gdk_wayland_window_show;
1319   impl_class->hide = gdk_wayland_window_hide;
1320   impl_class->withdraw = gdk_window_wayland_withdraw;
1321   impl_class->set_events = gdk_window_wayland_set_events;
1322   impl_class->get_events = gdk_window_wayland_get_events;
1323   impl_class->raise = gdk_window_wayland_raise;
1324   impl_class->lower = gdk_window_wayland_lower;
1325   impl_class->restack_under = gdk_window_wayland_restack_under;
1326   impl_class->restack_toplevel = gdk_window_wayland_restack_toplevel;
1327   impl_class->move_resize = gdk_window_wayland_move_resize;
1328   impl_class->set_background = gdk_window_wayland_set_background;
1329   impl_class->reparent = gdk_window_wayland_reparent;
1330   impl_class->set_device_cursor = gdk_window_wayland_set_device_cursor;
1331   impl_class->get_geometry = gdk_window_wayland_get_geometry;
1332   impl_class->get_root_coords = gdk_window_wayland_get_root_coords;
1333   impl_class->get_device_state = gdk_window_wayland_get_device_state;
1334   impl_class->shape_combine_region = gdk_window_wayland_shape_combine_region;
1335   impl_class->input_shape_combine_region = gdk_window_wayland_input_shape_combine_region;
1336   impl_class->set_static_gravities = gdk_window_wayland_set_static_gravities;
1337   impl_class->queue_antiexpose = gdk_wayland_window_queue_antiexpose;
1338   impl_class->translate = gdk_wayland_window_translate;
1339   impl_class->destroy = gdk_wayland_window_destroy;
1340   impl_class->destroy_foreign = gdk_window_wayland_destroy_foreign;
1341   impl_class->resize_cairo_surface = gdk_window_wayland_resize_cairo_surface;
1342   impl_class->get_shape = gdk_wayland_window_get_shape;
1343   impl_class->get_input_shape = gdk_wayland_window_get_input_shape;
1344   /* impl_class->beep */
1345
1346   impl_class->focus = gdk_wayland_window_focus;
1347   impl_class->set_type_hint = gdk_wayland_window_set_type_hint;
1348   impl_class->get_type_hint = gdk_wayland_window_get_type_hint;
1349   impl_class->set_modal_hint = gdk_wayland_window_set_modal_hint;
1350   impl_class->set_skip_taskbar_hint = gdk_wayland_window_set_skip_taskbar_hint;
1351   impl_class->set_skip_pager_hint = gdk_wayland_window_set_skip_pager_hint;
1352   impl_class->set_urgency_hint = gdk_wayland_window_set_urgency_hint;
1353   impl_class->set_geometry_hints = gdk_wayland_window_set_geometry_hints;
1354   impl_class->set_title = gdk_wayland_window_set_title;
1355   impl_class->set_role = gdk_wayland_window_set_role;
1356   impl_class->set_startup_id = gdk_wayland_window_set_startup_id;
1357   impl_class->set_transient_for = gdk_wayland_window_set_transient_for;
1358   impl_class->get_root_origin = gdk_wayland_window_get_root_origin;
1359   impl_class->get_frame_extents = gdk_wayland_window_get_frame_extents;
1360   impl_class->set_override_redirect = gdk_wayland_window_set_override_redirect;
1361   impl_class->set_accept_focus = gdk_wayland_window_set_accept_focus;
1362   impl_class->set_focus_on_map = gdk_wayland_window_set_focus_on_map;
1363   impl_class->set_icon_list = gdk_wayland_window_set_icon_list;
1364   impl_class->set_icon_name = gdk_wayland_window_set_icon_name;
1365   impl_class->iconify = gdk_wayland_window_iconify;
1366   impl_class->deiconify = gdk_wayland_window_deiconify;
1367   impl_class->stick = gdk_wayland_window_stick;
1368   impl_class->unstick = gdk_wayland_window_unstick;
1369   impl_class->maximize = gdk_wayland_window_maximize;
1370   impl_class->unmaximize = gdk_wayland_window_unmaximize;
1371   impl_class->fullscreen = gdk_wayland_window_fullscreen;
1372   impl_class->unfullscreen = gdk_wayland_window_unfullscreen;
1373   impl_class->set_keep_above = gdk_wayland_window_set_keep_above;
1374   impl_class->set_keep_below = gdk_wayland_window_set_keep_below;
1375   impl_class->get_group = gdk_wayland_window_get_group;
1376   impl_class->set_group = gdk_wayland_window_set_group;
1377   impl_class->set_decorations = gdk_wayland_window_set_decorations;
1378   impl_class->get_decorations = gdk_wayland_window_get_decorations;
1379   impl_class->set_functions = gdk_wayland_window_set_functions;
1380   impl_class->begin_resize_drag = gdk_wayland_window_begin_resize_drag;
1381   impl_class->begin_move_drag = gdk_wayland_window_begin_move_drag;
1382   impl_class->enable_synchronized_configure = gdk_wayland_window_enable_synchronized_configure;
1383   impl_class->configure_finished = gdk_wayland_window_configure_finished;
1384   impl_class->set_opacity = gdk_wayland_window_set_opacity;
1385   impl_class->set_composited = gdk_wayland_window_set_composited;
1386   impl_class->destroy_notify = gdk_wayland_window_destroy_notify;
1387   impl_class->get_drag_protocol = _gdk_wayland_window_get_drag_protocol;
1388   impl_class->register_dnd = _gdk_wayland_window_register_dnd;
1389   impl_class->drag_begin = _gdk_wayland_window_drag_begin;
1390   impl_class->process_updates_recurse = gdk_wayland_window_process_updates_recurse;
1391   impl_class->sync_rendering = gdk_wayland_window_sync_rendering;
1392   impl_class->simulate_key = gdk_wayland_window_simulate_key;
1393   impl_class->simulate_button = gdk_wayland_window_simulate_button;
1394   impl_class->get_property = gdk_wayland_window_get_property;
1395   impl_class->change_property = gdk_wayland_window_change_property;
1396   impl_class->delete_property = gdk_wayland_window_delete_property;
1397 }