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