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