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