]> Pileus Git - ~andy/gtk/blob - gdk/broadway/gdkdisplay-broadway.c
[broadway] Update to new GDK backend APIs
[~andy/gtk] / gdk / broadway / gdkdisplay-broadway.c
1 /* GDK - The GIMP Drawing Kit
2  * gdkdisplay-broadway.c
3  * 
4  * Copyright 2001 Sun Microsystems Inc.
5  * Copyright (C) 2004 Nokia Corporation
6  *
7  * Erwann Chenede <erwann.chenede@sun.com>
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Library General Public
11  * License as published by the Free Software Foundation; either
12  * version 2 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Library General Public License for more details.
18  *
19  * You should have received a copy of the GNU Library General Public
20  * License along with this library; if not, write to the
21  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22  * Boston, MA 02111-1307, USA.
23  */
24
25 #include "config.h"
26
27 #include "gdkdisplay-broadway.h"
28
29 #include "gdkdisplay.h"
30 #include "gdkeventsource.h"
31 #include "gdkscreen.h"
32 #include "gdkscreen-broadway.h"
33 #include "gdkinternals.h"
34 #include "gdkdeviceprivate.h"
35 #include "gdkdevicemanager-broadway.h"
36
37 #include <glib.h>
38 #include <glib/gprintf.h>
39 #include <stdlib.h>
40 #include <string.h>
41 #include <errno.h>
42 #include <unistd.h>
43
44 static void   gdk_broadway_display_dispose            (GObject            *object);
45 static void   gdk_broadway_display_finalize           (GObject            *object);
46
47 G_DEFINE_TYPE (GdkBroadwayDisplay, gdk_broadway_display, GDK_TYPE_DISPLAY)
48
49 static void
50 gdk_broadway_display_init (GdkBroadwayDisplay *display)
51 {
52   _gdk_broadway_display_manager_add_display (gdk_display_manager_get (),
53                                              GDK_DISPLAY_OBJECT (display));
54   display->id_ht = g_hash_table_new (NULL, NULL);
55 }
56
57 static void
58 gdk_event_init (GdkDisplay *display)
59 {
60   GdkBroadwayDisplay *broadway_display;
61
62   broadway_display = GDK_BROADWAY_DISPLAY (display);
63   broadway_display->event_source = _gdk_broadway_event_source_new (display);
64 }
65
66 static void
67 gdk_broadway_display_init_input (GdkDisplay *display)
68 {
69   GdkBroadwayDisplay *broadway_display;
70   GdkDeviceManager *device_manager;
71   GdkDevice *device;
72   GList *list, *l;
73
74   broadway_display = GDK_BROADWAY_DISPLAY (display);
75   device_manager = gdk_display_get_device_manager (display);
76
77   /* For backwards compatibility, just add
78    * floating devices that are not keyboards.
79    */
80   list = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_FLOATING);
81
82   for (l = list; l; l = l->next)
83     {
84       device = l->data;
85
86       if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
87         continue;
88
89       broadway_display->input_devices = g_list_prepend (broadway_display->input_devices,
90                                                    g_object_ref (l->data));
91     }
92
93   g_list_free (list);
94
95   /* Now set "core" pointer to the first
96    * master device that is a pointer.
97    */
98   list = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER);
99
100   for (l = list; l; l = l->next)
101     {
102       device = list->data;
103
104       if (gdk_device_get_source (device) != GDK_SOURCE_MOUSE)
105         continue;
106
107       display->core_pointer = device;
108       break;
109     }
110
111   /* Add the core pointer to the devices list */
112   broadway_display->input_devices = g_list_prepend (broadway_display->input_devices,
113                                                g_object_ref (display->core_pointer));
114
115   g_list_free (list);
116 }
117
118 struct HttpRequest {
119   GdkDisplay *display;
120   GSocketConnection *connection;
121   GDataInputStream *data;
122   GString *request;
123 };
124
125 static void
126 http_request_free (HttpRequest *request)
127 {
128   g_object_unref (request->connection);
129   g_object_unref (request->data);
130   g_string_free (request->request, TRUE);
131   g_free (request);
132 }
133
134 #include <unistd.h>
135 #include <fcntl.h>
136 static void
137 set_fd_blocking (int fd)
138 {
139   glong arg;
140
141   if ((arg = fcntl (fd, F_GETFL, NULL)) < 0)
142     arg = 0;
143
144   arg = arg & ~O_NONBLOCK;
145
146   fcntl (fd, F_SETFL, arg);
147 }
148
149 static char *
150 parse_line (char *line, char *key)
151 {
152   char *p;
153
154   if (!g_str_has_prefix (line, key))
155     return NULL;
156   p = line + strlen (key);
157   if (*p != ':')
158     return NULL;
159   p++;
160   /* Skip optional initial space */
161   if (*p == ' ')
162     p++;
163   return p;
164 }
165
166 static void
167 got_input (GInputStream *stream,
168            GAsyncResult *result,
169            HttpRequest *request)
170 {
171   GError *error;
172   char *message;
173   gsize len;
174
175   error = NULL;
176   message = g_data_input_stream_read_upto_finish (G_DATA_INPUT_STREAM (stream), result, &len, &error);
177   if (message == NULL)
178     {
179       GDK_BROADWAY_DISPLAY (request->display)->input = NULL;
180       http_request_free (request);
181       return;
182     }
183
184   g_assert (message[0] == 0);
185   _gdk_broadway_events_got_input (request->display, message + 1);
186
187   /* Skip past ending 0xff */
188   g_data_input_stream_read_byte (request->data, NULL, NULL);
189   g_data_input_stream_read_upto_async (request->data, "\xff", 1, 0, NULL,
190                                        (GAsyncReadyCallback)got_input, request);
191 }
192
193 static void
194 send_error (HttpRequest *request,
195             int error_code,
196             const char *reason)
197 {
198   char *res;
199
200   res = g_strdup_printf ("HTTP/1.0 %d %s\r\n\r\n"
201                          "<html><head><title>%d %s</title></head>"
202                          "<body>%s</body></html>",
203                          error_code, reason,
204                          error_code, reason,
205                          reason);
206   /* TODO: This should really be async */
207   g_output_stream_write_all (g_io_stream_get_output_stream (G_IO_STREAM (request->connection)),
208                              res, strlen (res), NULL, NULL, NULL);
209   g_free (res);
210   http_request_free (request);
211 }
212
213 static void
214 start_input (HttpRequest *request)
215 {
216   char **lines;
217   char *p;
218   int num_key1, num_key2;
219   guint64 key1, key2;
220   int num_space;
221   int i;
222   guint8 challenge[16];
223   char *res;
224   gsize len;
225   GChecksum *checksum;
226   char *origin, *host;
227   GdkBroadwayDisplay *broadway_display;
228
229   broadway_display = GDK_BROADWAY_DISPLAY (request->display);
230
231   if (broadway_display->input != NULL)
232     {
233       send_error (request, 409, "Input already handled");
234       return;
235     }
236
237   lines = g_strsplit (request->request->str, "\n", 0);
238
239   num_key1 = 0;
240   num_key2 = 0;
241   key1 = 0;
242   key2 = 0;
243   origin = NULL;
244   host = NULL;
245   for (i = 0; lines[i] != NULL; i++)
246     {
247       if ((p = parse_line (lines[i], "Sec-WebSocket-Key1")))
248         {
249           num_space = 0;
250           while (*p != 0)
251             {
252               if (g_ascii_isdigit (*p))
253                 key1 = key1 * 10 + g_ascii_digit_value (*p);
254               else if (*p == ' ')
255                 num_space++;
256
257               p++;
258             }
259           key1 /= num_space;
260           num_key1++;
261         }
262       else if ((p = parse_line (lines[i], "Sec-WebSocket-Key2")))
263         {
264           num_space = 0;
265           while (*p != 0)
266             {
267               if (g_ascii_isdigit (*p))
268                 key2 = key2 * 10 + g_ascii_digit_value (*p);
269               else if (*p == ' ')
270                 num_space++;
271
272               p++;
273             }
274           key2 /= num_space;
275           num_key2++;
276         }
277       else if ((p = parse_line (lines[i], "Origin")))
278         {
279           origin = p;
280         }
281       else if ((p = parse_line (lines[i], "Host")))
282         {
283           host = p;
284         }
285     }
286
287   if (num_key1 != 1 || num_key2 != 1 || origin == NULL || host == NULL)
288     {
289       g_strfreev (lines);
290       send_error (request, 400, "Bad websocket request");
291       return;
292     }
293
294   challenge[0] = (key1 >> 24) & 0xff;
295   challenge[1] = (key1 >> 16) & 0xff;
296   challenge[2] = (key1 >>  8) & 0xff;
297   challenge[3] = (key1 >>  0) & 0xff;
298   challenge[4] = (key2 >> 24) & 0xff;
299   challenge[5] = (key2 >> 16) & 0xff;
300   challenge[6] = (key2 >>  8) & 0xff;
301   challenge[7] = (key2 >>  0) & 0xff;
302
303   if (!g_input_stream_read_all (G_INPUT_STREAM (request->data), challenge+8, 8, NULL, NULL, NULL))
304     {
305       g_strfreev (lines);
306       send_error (request, 400, "Bad websocket request");
307       return;
308     }
309
310   checksum = g_checksum_new (G_CHECKSUM_MD5);
311   g_checksum_update (checksum, challenge, 16);
312   len = 16;
313   g_checksum_get_digest (checksum, challenge, &len);
314   g_checksum_free (checksum);
315
316   res = g_strdup_printf ("HTTP/1.1 101 WebSocket Protocol Handshake\r\n"
317                          "Upgrade: WebSocket\r\n"
318                          "Connection: Upgrade\r\n"
319                          "Sec-WebSocket-Origin: %s\r\n"
320                          "Sec-WebSocket-Location: ws://%s/input\r\n"
321                          "Sec-WebSocket-Protocol: broadway\r\n"
322                          "\r\n",
323                          origin, host);
324
325   /* TODO: This should really be async */
326   g_output_stream_write_all (g_io_stream_get_output_stream (G_IO_STREAM (request->connection)),
327                              res, strlen (res), NULL, NULL, NULL);
328   g_free (res);
329   g_output_stream_write_all (g_io_stream_get_output_stream (G_IO_STREAM (request->connection)),
330                              challenge, 16, NULL, NULL, NULL);
331
332   broadway_display->input = request;
333
334   g_data_input_stream_read_upto_async (request->data, "\xff", 1, 0, NULL,
335                                        (GAsyncReadyCallback)got_input, request);
336
337   g_strfreev (lines);
338 }
339
340 static void
341 start_output (HttpRequest *request)
342 {
343   GSocket *socket;
344   GdkBroadwayDisplay *broadway_display;
345   int fd;
346
347   socket = g_socket_connection_get_socket (request->connection);
348
349   broadway_display = GDK_BROADWAY_DISPLAY (request->display);
350   fd = g_socket_get_fd (socket);
351   set_fd_blocking (fd);
352   /* We dup this because otherwise it'll be closed with the request SocketConnection */
353   broadway_display->output = broadway_output_new (dup(fd));
354   _gdk_broadway_resync_windows ();
355   http_request_free (request);
356 }
357
358 static void
359 send_data (HttpRequest *request,
360              const char *mimetype,
361              const char *data, gsize len)
362 {
363   char *res;
364
365   res = g_strdup_printf ("HTTP/1.0 200 OK\r\n"
366                          "Content-Type: %s\r\n"
367                          "Content-Length: %"G_GSIZE_FORMAT"\r\n"
368                          "\r\n",
369                          mimetype, len);
370   /* TODO: This should really be async */
371   g_output_stream_write_all (g_io_stream_get_output_stream (G_IO_STREAM (request->connection)),
372                              res, strlen (res), NULL, NULL, NULL);
373   g_free (res);
374   g_output_stream_write_all (g_io_stream_get_output_stream (G_IO_STREAM (request->connection)),
375                              data, len, NULL, NULL, NULL);
376   http_request_free (request);
377 }
378
379 #include "clienthtml.h"
380 #include "broadwayjs.h"
381
382 static void
383 got_request (HttpRequest *request)
384 {
385   char *start, *escaped, *tmp, *version;
386
387   if (!g_str_has_prefix (request->request->str, "GET "))
388     {
389       send_error (request, 501, "Only GET implemented");
390       return;
391     }
392
393   start = request->request->str + 4; /* Skip "GET " */
394
395   while (*start == ' ')
396     start++;
397
398   for (tmp = start; *tmp != 0 && *tmp != ' ' && *tmp != '\n'; tmp++)
399     ;
400   escaped = g_strndup (start, tmp - start);
401   version = NULL;
402   if (*tmp == ' ')
403     {
404       start = tmp;
405       while (*start == ' ')
406         start++;
407       for (tmp = start; *tmp != 0 && *tmp != ' ' && *tmp != '\n'; tmp++)
408         ;
409       version = g_strndup (start, tmp - start);
410     }
411
412   if (strcmp (escaped, "/client.html") == 0 || strcmp (escaped, "/") == 0)
413     send_data (request, "text/html", client_html, G_N_ELEMENTS(client_html) - 1);
414   else if (strcmp (escaped, "/broadway.js") == 0)
415     send_data (request, "text/javascript", broadway_js, G_N_ELEMENTS(broadway_js) - 1);
416   else if (strcmp (escaped, "/output") == 0)
417     start_output (request);
418   else if (strcmp (escaped, "/input") == 0)
419     start_input (request);
420   else
421     send_error (request, 404, "File not found");
422 }
423
424 static void
425 got_http_request_line (GInputStream *stream,
426                        GAsyncResult *result,
427                        HttpRequest *request)
428 {
429   char *line;
430
431   line = g_data_input_stream_read_line_finish (G_DATA_INPUT_STREAM (stream), result, NULL, NULL);
432   if (line == NULL)
433     {
434       http_request_free (request);
435       g_printerr ("Error reading request lines\n");
436       return;
437     }
438   if (strlen (line) == 0)
439     got_request (request);
440   else
441     {
442       /* Protect against overflow in request length */
443       if (request->request->len > 1024 * 5)
444         {
445           send_error (request, 400, "Request to long");
446         }
447       else
448         {
449           g_string_append_printf (request->request, "%s\n", line);
450           g_data_input_stream_read_line_async (request->data, 0, NULL,
451                                                (GAsyncReadyCallback)got_http_request_line, request);
452         }
453     }
454   g_free (line);
455 }
456
457 static gboolean
458 handle_incoming_connection (GSocketService    *service,
459                             GSocketConnection *connection,
460                             GObject           *source_object)
461 {
462   HttpRequest *request;
463   GInputStream *in;
464
465   request = g_new0 (HttpRequest, 1);
466   request->connection = g_object_ref (connection);
467   request->display = (GdkDisplay *) source_object;
468   request->request = g_string_new ("");
469
470   in = g_io_stream_get_input_stream (G_IO_STREAM (connection));
471
472   request->data = g_data_input_stream_new (in);
473   g_filter_input_stream_set_close_base_stream (G_FILTER_INPUT_STREAM (request->data), FALSE);
474   /* Be tolerant of input */
475   g_data_input_stream_set_newline_type (request->data, G_DATA_STREAM_NEWLINE_TYPE_ANY);
476
477   g_data_input_stream_read_line_async (request->data, 0, NULL,
478                                        (GAsyncReadyCallback)got_http_request_line, request);
479   return TRUE;
480 }
481
482 GdkDisplay *
483 _gdk_broadway_display_open (const gchar *display_name)
484 {
485   GdkDisplay *display;
486   GdkBroadwayDisplay *broadway_display;
487   GError *error;
488
489   display = g_object_new (GDK_TYPE_BROADWAY_DISPLAY, NULL);
490   broadway_display = GDK_BROADWAY_DISPLAY (display);
491
492   broadway_display->output = NULL;
493
494   /* initialize the display's screens */
495   broadway_display->screens = g_new (GdkScreen *, 1);
496   broadway_display->screens[0] = _gdk_broadway_screen_new (display, 0);
497
498   /* We need to initialize events after we have the screen
499    * structures in places
500    */
501   _gdk_broadway_screen_events_init (broadway_display->screens[0]);
502
503   /*set the default screen */
504   broadway_display->default_screen = broadway_display->screens[0];
505
506   display->device_manager = _gdk_broadway_device_manager_new (display);
507
508   gdk_event_init (display);
509
510   gdk_broadway_display_init_input (display);
511   _gdk_broadway_display_init_dnd (display);
512
513   _gdk_broadway_screen_setup (broadway_display->screens[0]);
514
515   broadway_display->service = g_socket_service_new ();
516   if (!g_socket_listener_add_inet_port (G_SOCKET_LISTENER (broadway_display->service),
517                                         8080,
518                                         G_OBJECT (display),
519                                         &error))
520     {
521       g_printerr ("Unable to listen to port %d: %s\n", 8080, error->message);
522       g_error_free (error);
523       return NULL;
524     }
525   g_signal_connect (broadway_display->service, "incoming", G_CALLBACK (handle_incoming_connection), NULL);
526
527   g_signal_emit_by_name (display, "opened");
528   g_signal_emit_by_name (gdk_display_manager_get (), "display-opened", display);
529
530   return display;
531 }
532
533
534 static G_CONST_RETURN gchar *
535 gdk_broadway_display_get_name (GdkDisplay *display)
536 {
537   g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
538
539   return (gchar *) "Broadway";
540 }
541
542 static gint
543 gdk_broadway_display_get_n_screens (GdkDisplay *display)
544 {
545   g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
546
547   return 1;
548 }
549
550 static GdkScreen *
551 gdk_broadway_display_get_screen (GdkDisplay *display,
552                                  gint        screen_num)
553 {
554   g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
555   g_return_val_if_fail (screen_num == 0, NULL);
556
557   return GDK_BROADWAY_DISPLAY (display)->screens[screen_num];
558 }
559
560 static GdkScreen *
561 gdk_broadway_display_get_default_screen (GdkDisplay *display)
562 {
563   g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
564
565   return GDK_BROADWAY_DISPLAY (display)->default_screen;
566 }
567
568 static void
569 gdk_broadway_display_beep (GdkDisplay *display)
570 {
571   g_return_if_fail (GDK_IS_DISPLAY (display));
572 }
573
574 static void
575 gdk_broadway_display_sync (GdkDisplay *display)
576 {
577   g_return_if_fail (GDK_IS_DISPLAY (display));
578
579 }
580
581 static void
582 gdk_broadway_display_flush (GdkDisplay *display)
583 {
584   g_return_if_fail (GDK_IS_DISPLAY (display));
585
586 }
587
588 static gboolean
589 gdk_broadway_display_has_pending (GdkDisplay *display)
590 {
591   return FALSE;
592 }
593
594 static GdkWindow *
595 gdk_broadway_display_get_default_group (GdkDisplay *display)
596 {
597   g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
598
599   return NULL;
600 }
601
602 static void
603 gdk_broadway_display_dispose (GObject *object)
604 {
605   GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (object);
606
607   _gdk_broadway_display_manager_remove_display (gdk_display_manager_get (),
608                                                 GDK_DISPLAY_OBJECT (object));
609
610   g_list_foreach (broadway_display->input_devices, (GFunc) g_object_run_dispose, NULL);
611
612   _gdk_screen_close (broadway_display->screens[0]);
613
614   if (broadway_display->event_source)
615     {
616       g_source_destroy (broadway_display->event_source);
617       g_source_unref (broadway_display->event_source);
618       broadway_display->event_source = NULL;
619     }
620
621   G_OBJECT_CLASS (gdk_broadway_display_parent_class)->dispose (object);
622 }
623
624 static void
625 gdk_broadway_display_finalize (GObject *object)
626 {
627   GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (object);
628
629   /* Keymap */
630   if (broadway_display->keymap)
631     g_object_unref (broadway_display->keymap);
632
633   _gdk_broadway_cursor_display_finalize (GDK_DISPLAY_OBJECT(broadway_display));
634
635   /* Atom Hashtable */
636   g_hash_table_destroy (broadway_display->atom_from_virtual);
637   g_hash_table_destroy (broadway_display->atom_to_virtual);
638
639   /* input GdkDevice list */
640   g_list_foreach (broadway_display->input_devices, (GFunc) g_object_unref, NULL);
641   g_list_free (broadway_display->input_devices);
642   /* Free all GdkScreens */
643   g_object_unref (broadway_display->screens[0]);
644   g_free (broadway_display->screens);
645
646   G_OBJECT_CLASS (gdk_broadway_display_parent_class)->finalize (object);
647 }
648
649 void
650 _gdk_broadway_display_make_default (GdkDisplay *display)
651 {
652 }
653
654 static void
655 gdk_broadway_display_notify_startup_complete (GdkDisplay  *display,
656                                               const gchar *startup_id)
657 {
658 }
659
660 static gboolean
661 gdk_broadway_display_supports_selection_notification (GdkDisplay *display)
662 {
663   return FALSE;
664 }
665
666 static gboolean
667 gdk_broadway_display_request_selection_notification (GdkDisplay *display,
668                                                      GdkAtom     selection)
669
670 {
671     return FALSE;
672 }
673
674 static gboolean
675 gdk_broadway_display_supports_clipboard_persistence (GdkDisplay *display)
676 {
677   return FALSE;
678 }
679
680 static void
681 gdk_broadway_display_store_clipboard (GdkDisplay    *display,
682                                       GdkWindow     *clipboard_window,
683                                       guint32        time_,
684                                       const GdkAtom *targets,
685                                       gint           n_targets)
686 {
687 }
688
689 static gboolean
690 gdk_broadway_display_supports_shapes (GdkDisplay *display)
691 {
692   return FALSE;
693 }
694
695 static gboolean
696 gdk_broadway_display_supports_input_shapes (GdkDisplay *display)
697 {
698   return FALSE;
699 }
700
701 static gboolean
702 gdk_broadway_display_supports_composite (GdkDisplay *display)
703 {
704   return FALSE;
705 }
706
707 static GList *
708 gdk_broadway_display_list_devices (GdkDisplay *display)
709 {
710   g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
711
712   return GDK_BROADWAY_DISPLAY (display)->input_devices;
713 }
714
715 static gulong
716 gdk_broadway_display_get_next_serial (GdkDisplay *display)
717 {
718   return 0;
719 }
720
721
722 static void
723 gdk_broadway_display_event_data_copy (GdkDisplay    *display,
724                                       const GdkEvent *src,
725                                       GdkEvent       *dst)
726 {
727 }
728
729 static void
730 gdk_broadway_display_event_data_free (GdkDisplay    *display,
731                                       GdkEvent *event)
732 {
733 }
734
735 static void
736 gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
737 {
738   GObjectClass *object_class = G_OBJECT_CLASS (class);
739   GdkDisplayClass *display_class = GDK_DISPLAY_CLASS (class);
740
741   object_class->dispose = gdk_broadway_display_dispose;
742   object_class->finalize = gdk_broadway_display_finalize;
743
744   display_class->window_type = GDK_TYPE_BROADWAY_WINDOW;
745
746   display_class->get_name = gdk_broadway_display_get_name;
747   display_class->get_n_screens = gdk_broadway_display_get_n_screens;
748   display_class->get_screen = gdk_broadway_display_get_screen;
749   display_class->get_default_screen = gdk_broadway_display_get_default_screen;
750   display_class->beep = gdk_broadway_display_beep;
751   display_class->sync = gdk_broadway_display_sync;
752   display_class->flush = gdk_broadway_display_flush;
753   display_class->has_pending = gdk_broadway_display_has_pending;
754   display_class->queue_events = _gdk_broadway_display_queue_events;
755   display_class->get_default_group = gdk_broadway_display_get_default_group;
756   display_class->supports_selection_notification = gdk_broadway_display_supports_selection_notification;
757   display_class->request_selection_notification = gdk_broadway_display_request_selection_notification;
758   display_class->supports_clipboard_persistence = gdk_broadway_display_supports_clipboard_persistence;
759   display_class->store_clipboard = gdk_broadway_display_store_clipboard;
760   display_class->supports_shapes = gdk_broadway_display_supports_shapes;
761   display_class->supports_input_shapes = gdk_broadway_display_supports_input_shapes;
762   display_class->supports_composite = gdk_broadway_display_supports_composite;
763   display_class->list_devices = gdk_broadway_display_list_devices;
764   display_class->get_cursor_for_type = _gdk_broadway_display_get_cursor_for_type;
765   display_class->get_cursor_for_name = _gdk_broadway_display_get_cursor_for_name;
766   display_class->get_cursor_for_pixbuf = _gdk_broadway_display_get_cursor_for_pixbuf;
767   display_class->get_default_cursor_size = _gdk_broadway_display_get_default_cursor_size;
768   display_class->get_maximal_cursor_size = _gdk_broadway_display_get_maximal_cursor_size;
769   display_class->supports_cursor_alpha = _gdk_broadway_display_supports_cursor_alpha;
770   display_class->supports_cursor_color = _gdk_broadway_display_supports_cursor_color;
771
772   display_class->before_process_all_updates = _gdk_broadway_display_before_process_all_updates;
773   display_class->after_process_all_updates = _gdk_broadway_display_after_process_all_updates;
774   display_class->get_next_serial = gdk_broadway_display_get_next_serial;
775   display_class->notify_startup_complete = gdk_broadway_display_notify_startup_complete;
776   display_class->event_data_copy = gdk_broadway_display_event_data_copy;
777   display_class->event_data_free = gdk_broadway_display_event_data_free;
778   display_class->create_window_impl = _gdk_broadway_display_create_window_impl;
779   display_class->get_keymap = _gdk_broadway_display_get_keymap;
780   display_class->get_selection_owner = _gdk_broadway_display_get_selection_owner;
781   display_class->set_selection_owner = _gdk_broadway_display_set_selection_owner;
782   display_class->send_selection_notify = _gdk_broadway_display_send_selection_notify;
783   display_class->get_selection_property = _gdk_broadway_display_get_selection_property;
784   display_class->convert_selection = _gdk_broadway_display_convert_selection;
785   display_class->text_property_to_utf8_list = _gdk_broadway_display_text_property_to_utf8_list;
786   display_class->utf8_to_string_target = _gdk_broadway_display_utf8_to_string_target;
787 }
788