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