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