]> Pileus Git - ~andy/gtk/blob - gdk/win32/gdkdisplay-win32.c
win32: Fix some warnings
[~andy/gtk] / gdk / win32 / gdkdisplay-win32.c
1 /* GDK - The GIMP Drawing Kit
2  * Copyright (C) 2002,2005 Hans Breuer
3  * Copyright (C) 2003 Tor Lillqvist
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 #include "config.h"
22 #include "gdk.h"
23 #include "gdkprivate-win32.h"
24 #include "gdkdisplayprivate.h"
25 #include "gdkwin32display.h"
26 #include "gdkwin32screen.h"
27 #include "gdkwin32window.h"
28 #include "gdkwin32.h"
29
30 #define HAVE_MONITOR_INFO
31
32 #if defined(_MSC_VER) && (WINVER < 0x500) && (WINVER > 0x0400)
33 #include <multimon.h>
34 #elif defined(_MSC_VER) && (WINVER <= 0x0400)
35 #undef HAVE_MONITOR_INFO
36 #endif
37
38 void
39 _gdk_windowing_set_default_display (GdkDisplay *display)
40 {
41   g_assert (display == NULL || _gdk_display == display);
42 }
43
44 static gulong
45 gdk_win32_display_get_next_serial (GdkDisplay *display)
46 {
47         return 0;
48 }
49
50 #ifdef HAVE_MONITOR_INFO
51 static BOOL CALLBACK
52 count_monitor (HMONITOR hmonitor,
53                HDC      hdc,
54                LPRECT   rect,
55                LPARAM   data)
56 {
57   gint *n = (gint *) data;
58
59   (*n)++;
60
61   return TRUE;
62 }
63
64 static BOOL CALLBACK
65 enum_monitor (HMONITOR hmonitor,
66               HDC      hdc,
67               LPRECT   rect,
68               LPARAM   data)
69 {
70   /* The struct MONITORINFOEX definition is for some reason different
71    * in the winuser.h bundled with mingw64 from that in MSDN and the
72    * official 32-bit mingw (the MONITORINFO part is in a separate "mi"
73    * member). So to keep this easily compileable with either, repeat
74    * the MSDN definition it here.
75    */
76   typedef struct tagMONITORINFOEXA2 {
77     DWORD cbSize;
78     RECT  rcMonitor;
79     RECT  rcWork;
80     DWORD dwFlags;
81     CHAR szDevice[CCHDEVICENAME];
82   } MONITORINFOEXA2;
83
84   MONITORINFOEXA2 monitor_info;
85   HDC hDC;
86
87   gint *index = (gint *) data;
88   GdkWin32Monitor *monitor;
89
90   g_assert (*index < _gdk_num_monitors);
91
92   monitor = _gdk_monitors + *index;
93
94   monitor_info.cbSize = sizeof (MONITORINFOEX);
95   GetMonitorInfoA (hmonitor, (MONITORINFO *) &monitor_info);
96
97 #ifndef MONITORINFOF_PRIMARY
98 #define MONITORINFOF_PRIMARY 1
99 #endif
100
101   monitor->name = g_strdup (monitor_info.szDevice);
102   hDC = CreateDCA ("DISPLAY", monitor_info.szDevice, NULL, NULL);
103   monitor->width_mm = GetDeviceCaps (hDC, HORZSIZE);
104   monitor->height_mm = GetDeviceCaps (hDC, VERTSIZE);
105   DeleteDC (hDC);
106   monitor->rect.x = monitor_info.rcMonitor.left;
107   monitor->rect.y = monitor_info.rcMonitor.top;
108   monitor->rect.width = monitor_info.rcMonitor.right - monitor_info.rcMonitor.left;
109   monitor->rect.height = monitor_info.rcMonitor.bottom - monitor_info.rcMonitor.top;
110
111   if (monitor_info.dwFlags & MONITORINFOF_PRIMARY &&
112       *index != 0)
113     {
114       /* Put primary monitor at index 0, just in case somebody needs
115        * to know which one is the primary.
116        */
117       GdkWin32Monitor temp = *monitor;
118       *monitor = _gdk_monitors[0];
119       _gdk_monitors[0] = temp;
120     }
121
122   (*index)++;
123
124   return TRUE;
125 }
126 #endif /* HAVE_MONITOR_INFO */
127
128 void
129 _gdk_monitor_init (void)
130 {
131 #ifdef HAVE_MONITOR_INFO
132   gint i, index;
133
134   _gdk_num_monitors = 0;
135
136   EnumDisplayMonitors (NULL, NULL, count_monitor, (LPARAM) &_gdk_num_monitors);
137
138   _gdk_monitors = g_renew (GdkWin32Monitor, _gdk_monitors, _gdk_num_monitors);
139
140   index = 0;
141   EnumDisplayMonitors (NULL, NULL, enum_monitor, (LPARAM) &index);
142
143   _gdk_offset_x = G_MININT;
144   _gdk_offset_y = G_MININT;
145
146   /* Calculate offset */
147   for (i = 0; i < _gdk_num_monitors; i++)
148     {
149       _gdk_offset_x = MAX (_gdk_offset_x, -_gdk_monitors[i].rect.x);
150       _gdk_offset_y = MAX (_gdk_offset_y, -_gdk_monitors[i].rect.y);
151     }
152   GDK_NOTE (MISC, g_print ("Multi-monitor offset: (%d,%d)\n",
153                            _gdk_offset_x, _gdk_offset_y));
154
155   /* Translate monitor coords into GDK coordinate space */
156   for (i = 0; i < _gdk_num_monitors; i++)
157     {
158       _gdk_monitors[i].rect.x += _gdk_offset_x;
159       _gdk_monitors[i].rect.y += _gdk_offset_y;
160       GDK_NOTE (MISC, g_print ("Monitor %d: %dx%d@%+d%+d\n",
161                                i, _gdk_monitors[i].rect.width,
162                                _gdk_monitors[i].rect.height,
163                                _gdk_monitors[i].rect.x,
164                                _gdk_monitors[i].rect.y));
165     }
166 #else
167   HDC hDC;
168
169   _gdk_num_monitors = 1;
170   _gdk_monitors = g_renew (GdkWin32Monitor, _gdk_monitors, 1);
171
172   _gdk_monitors[0].name = g_strdup ("DISPLAY");
173   hDC = GetDC (NULL);
174   _gdk_monitors[0].width_mm = GetDeviceCaps (hDC, HORZSIZE);
175   _gdk_monitors[0].height_mm = GetDeviceCaps (hDC, VERTSIZE);
176   ReleaseDC (NULL, hDC);
177   _gdk_monitors[0].rect.x = 0;
178   _gdk_monitors[0].rect.y = 0;
179   _gdk_monitors[0].rect.width = GetSystemMetrics (SM_CXSCREEN);
180   _gdk_monitors[0].rect.height = GetSystemMetrics (SM_CYSCREEN);
181   _gdk_offset_x = 0;
182   _gdk_offset_y = 0;
183 #endif
184 }
185
186 GdkDisplay *
187 _gdk_win32_display_open (const gchar *display_name)
188 {
189   GDK_NOTE (MISC, g_print ("gdk_display_open: %s\n", (display_name ? display_name : "NULL")));
190
191   if (display_name == NULL ||
192       g_ascii_strcasecmp (display_name,
193                           gdk_display_get_name (_gdk_display)) == 0)
194     {
195       if (_gdk_display != NULL)
196         {
197           GDK_NOTE (MISC, g_print ("... return _gdk_display\n"));
198           return _gdk_display;
199         }
200     }
201   else
202     {
203       GDK_NOTE (MISC, g_print ("... return NULL\n"));
204       return NULL;
205     }
206
207   _gdk_display = g_object_new (GDK_TYPE_WIN32_DISPLAY, NULL);
208   _gdk_screen = g_object_new (GDK_TYPE_WIN32_SCREEN, NULL);
209
210   _gdk_monitor_init ();
211   _gdk_visual_init ();
212   _gdk_windowing_window_init (_gdk_screen);
213   _gdk_events_init ();
214   _gdk_input_init (_gdk_display);
215   _gdk_dnd_init ();
216
217   /* Precalculate display name */
218   (void) gdk_display_get_name (_gdk_display);
219
220   g_signal_emit_by_name (gdk_display_manager_get (),
221                          "display_opened", _gdk_display);
222
223   GDK_NOTE (MISC, g_print ("... _gdk_display now set up\n"));
224
225   return _gdk_display;
226 }
227
228 struct _GdkWin32Display
229 {
230   GdkDisplay display;
231 };
232
233 struct _GdkWin32DisplayClass
234 {
235   GdkDisplayClass display_class;
236 };
237
238 G_DEFINE_TYPE (GdkWin32Display, gdk_win32_display, GDK_TYPE_DISPLAY)
239
240 static const gchar *
241 gdk_win32_display_get_name (GdkDisplay *display)
242 {
243   HDESK hdesk = GetThreadDesktop (GetCurrentThreadId ());
244   char dummy;
245   char *desktop_name;
246   HWINSTA hwinsta = GetProcessWindowStation ();
247   char *window_station_name;
248   DWORD n;
249   DWORD session_id;
250   char *display_name;
251   static const char *display_name_cache = NULL;
252   typedef BOOL (WINAPI *PFN_ProcessIdToSessionId) (DWORD, DWORD *);
253   PFN_ProcessIdToSessionId processIdToSessionId;
254
255   g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
256
257   if (display_name_cache != NULL)
258     return display_name_cache;
259
260   n = 0;
261   GetUserObjectInformation (hdesk, UOI_NAME, &dummy, 0, &n);
262   if (n == 0)
263     desktop_name = "Default";
264   else
265     {
266       n++;
267       desktop_name = g_alloca (n + 1);
268       memset (desktop_name, 0, n + 1);
269
270       if (!GetUserObjectInformation (hdesk, UOI_NAME, desktop_name, n, &n))
271         desktop_name = "Default";
272     }
273
274   n = 0;
275   GetUserObjectInformation (hwinsta, UOI_NAME, &dummy, 0, &n);
276   if (n == 0)
277     window_station_name = "WinSta0";
278   else
279     {
280       n++;
281       window_station_name = g_alloca (n + 1);
282       memset (window_station_name, 0, n + 1);
283
284       if (!GetUserObjectInformation (hwinsta, UOI_NAME, window_station_name, n, &n))
285         window_station_name = "WinSta0";
286     }
287
288   processIdToSessionId = (PFN_ProcessIdToSessionId) GetProcAddress (GetModuleHandle ("kernel32.dll"), "ProcessIdToSessionId");
289   if (!processIdToSessionId || !processIdToSessionId (GetCurrentProcessId (), &session_id))
290     session_id = 0;
291
292   display_name = g_strdup_printf ("%ld\\%s\\%s",
293                                   session_id,
294                                   window_station_name,
295                                   desktop_name);
296
297   GDK_NOTE (MISC, g_print ("gdk_win32_display_get_name: %s\n", display_name));
298
299   display_name_cache = display_name;
300
301   return display_name_cache;
302 }
303
304 static gint
305 gdk_win32_display_get_n_screens (GdkDisplay *display)
306 {
307   g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
308
309   return 1;
310 }
311
312 static GdkScreen *
313 gdk_win32_display_get_screen (GdkDisplay *display,
314                               gint        screen_num)
315 {
316   g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
317   g_return_val_if_fail (screen_num == 0, NULL);
318
319   return _gdk_screen;
320 }
321
322 static GdkScreen *
323 gdk_win32_display_get_default_screen (GdkDisplay *display)
324 {
325   g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
326
327   return _gdk_screen;
328 }
329
330 static GdkWindow *
331 gdk_win32_display_get_default_group (GdkDisplay *display)
332 {
333   g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
334
335   g_warning ("gdk_display_get_default_group not yet implemented");
336
337   return NULL;
338 }
339
340 static gboolean
341 gdk_win32_display_supports_selection_notification (GdkDisplay *display)
342 {
343   g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
344
345   return TRUE;
346 }
347
348 static HWND _hwnd_next_viewer = NULL;
349 static int debug_indent = 0;
350
351 /*
352  * maybe this should be integrated with the default message loop - or maybe not ;-)
353  */
354 static LRESULT CALLBACK
355 inner_clipboard_window_procedure (HWND   hwnd,
356                                   UINT   message,
357                                   WPARAM wparam,
358                                   LPARAM lparam)
359 {
360   switch (message)
361     {
362     case WM_DESTROY: /* remove us from chain */
363       {
364         ChangeClipboardChain (hwnd, _hwnd_next_viewer);
365         PostQuitMessage (0);
366         return 0;
367       }
368     case WM_CHANGECBCHAIN:
369       {
370         HWND hwndRemove = (HWND) wparam; /* handle of window being removed */
371         HWND hwndNext   = (HWND) lparam; /* handle of next window in chain */
372
373         if (hwndRemove == _hwnd_next_viewer)
374           _hwnd_next_viewer = hwndNext == hwnd ? NULL : hwndNext;
375         else if (_hwnd_next_viewer != NULL)
376           return SendMessage (_hwnd_next_viewer, message, wparam, lparam);
377
378         return 0;
379       }
380 #ifdef WM_CLIPBOARDUPDATE
381     case WM_CLIPBOARDUPDATE:
382 #endif
383     case WM_DRAWCLIPBOARD:
384       {
385         int success;
386         HWND hwndOwner;
387 #ifdef G_ENABLE_DEBUG
388         UINT nFormat = 0;
389 #endif
390         GdkEvent *event;
391         GdkWindow *owner;
392
393         success = OpenClipboard (hwnd);
394         g_return_val_if_fail (success, 0);
395         hwndOwner = GetClipboardOwner ();
396         owner = gdk_win32_window_lookup_for_display (_gdk_display, hwndOwner);
397         if (owner == NULL)
398           owner = gdk_win32_window_foreign_new_for_display (_gdk_display, hwndOwner);
399
400         GDK_NOTE (DND, g_print (" drawclipboard owner: %p", hwndOwner));
401
402 #ifdef G_ENABLE_DEBUG
403         if (_gdk_debug_flags & GDK_DEBUG_DND)
404           {
405             while ((nFormat = EnumClipboardFormats (nFormat)) != 0)
406               g_print ("%s ", _gdk_win32_cf_to_string (nFormat));
407           }
408 #endif
409
410         GDK_NOTE (DND, g_print (" \n"));
411
412
413         event = gdk_event_new (GDK_OWNER_CHANGE);
414         event->owner_change.window = _gdk_root;
415         event->owner_change.owner = owner;
416         event->owner_change.reason = GDK_OWNER_CHANGE_NEW_OWNER;
417         event->owner_change.selection = GDK_SELECTION_CLIPBOARD;
418         event->owner_change.time = _gdk_win32_get_next_tick (0);
419         event->owner_change.selection_time = GDK_CURRENT_TIME;
420         _gdk_win32_append_event (event);
421
422         CloseClipboard ();
423
424         if (_hwnd_next_viewer != NULL)
425           return SendMessage (_hwnd_next_viewer, message, wparam, lparam);
426
427         /* clear error to avoid confusing SetClipboardViewer() return */
428         SetLastError (0);
429         return 0;
430       }
431     default:
432       /* Otherwise call DefWindowProcW(). */
433       GDK_NOTE (EVENTS, g_print (" DefWindowProcW"));
434       return DefWindowProc (hwnd, message, wparam, lparam);
435     }
436 }
437
438 static LRESULT CALLBACK
439 _clipboard_window_procedure (HWND   hwnd,
440                              UINT   message,
441                              WPARAM wparam,
442                              LPARAM lparam)
443 {
444   LRESULT retval;
445
446   GDK_NOTE (EVENTS, g_print ("%s%*s%s %p",
447                              (debug_indent > 0 ? "\n" : ""),
448                              debug_indent, "",
449                              _gdk_win32_message_to_string (message), hwnd));
450   debug_indent += 2;
451   retval = inner_clipboard_window_procedure (hwnd, message, wparam, lparam);
452   debug_indent -= 2;
453
454   GDK_NOTE (EVENTS, g_print (" => %I64d%s", (gint64) retval, (debug_indent == 0 ? "\n" : "")));
455
456   return retval;
457 }
458
459 /*
460  * Creates a hidden window and adds it to the clipboard chain
461  */
462 static HWND
463 _gdk_win32_register_clipboard_notification (void)
464 {
465   WNDCLASS wclass = { 0, };
466   HWND     hwnd;
467   ATOM     klass;
468
469   wclass.lpszClassName = "GdkClipboardNotification";
470   wclass.lpfnWndProc   = _clipboard_window_procedure;
471   wclass.hInstance     = _gdk_app_hmodule;
472
473   klass = RegisterClass (&wclass);
474   if (!klass)
475     return NULL;
476
477   hwnd = CreateWindow (MAKEINTRESOURCE (klass),
478                        NULL, WS_POPUP,
479                        0, 0, 0, 0, NULL, NULL,
480                        _gdk_app_hmodule, NULL);
481   if (!hwnd)
482     goto failed;
483
484   SetLastError (0);
485   _hwnd_next_viewer = SetClipboardViewer (hwnd);
486
487   if (_hwnd_next_viewer == NULL && GetLastError() != 0)
488     goto failed;
489
490   /* FIXME: http://msdn.microsoft.com/en-us/library/ms649033(v=VS.85).aspx */
491   /* This is only supported by Vista, and not yet by mingw64 */
492   /* if (AddClipboardFormatListener (hwnd) == FALSE) */
493   /*   goto failed; */
494
495   return hwnd;
496
497 failed:
498   g_critical ("Failed to install clipboard viewer");
499   UnregisterClass (MAKEINTRESOURCE (klass), _gdk_app_hmodule);
500   return NULL;
501 }
502
503 static gboolean 
504 gdk_win32_display_request_selection_notification (GdkDisplay *display,
505                                                   GdkAtom     selection)
506
507 {
508   static HWND hwndViewer = NULL;
509   gboolean ret = FALSE;
510
511   GDK_NOTE (DND,
512             g_print ("gdk_display_request_selection_notification (..., %s)",
513                      gdk_atom_name (selection)));
514
515   if (selection == GDK_SELECTION_CLIPBOARD ||
516       selection == GDK_SELECTION_PRIMARY)
517     {
518       if (!hwndViewer)
519         {
520           hwndViewer = _gdk_win32_register_clipboard_notification ();
521           GDK_NOTE (DND, g_print (" registered"));
522         }
523       ret = (hwndViewer != NULL);
524     }
525   else
526     {
527       GDK_NOTE (DND, g_print (" unsupported"));
528       ret = FALSE;
529     }
530
531   GDK_NOTE (DND, g_print (" -> %s\n", ret ? "TRUE" : "FALSE"));
532   return ret;
533 }
534
535 static gboolean
536 gdk_win32_display_supports_clipboard_persistence (GdkDisplay *display)
537 {
538   return FALSE;
539 }
540
541 static void
542 gdk_win32_display_store_clipboard (GdkDisplay    *display,
543                              GdkWindow     *clipboard_window,
544                              guint32        time_,
545                              const GdkAtom *targets,
546                              gint           n_targets)
547 {
548 }
549
550 static gboolean 
551 gdk_win32_display_supports_shapes (GdkDisplay *display)
552 {
553   g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
554
555   return TRUE;
556 }
557
558 static gboolean
559 gdk_win32_display_supports_input_shapes (GdkDisplay *display)
560 {
561   g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
562
563   /* Not yet implemented. See comment in
564    * gdk_window_input_shape_combine_mask().
565    */
566
567   return FALSE;
568 }
569
570 static gboolean
571 gdk_win32_display_supports_composite (GdkDisplay *display)
572 {
573   return FALSE;
574 }
575
576 static void
577 gdk_win32_display_beep (GdkDisplay *display)
578 {
579   g_return_if_fail (display == gdk_display_get_default());
580   if (!MessageBeep (-1))
581     Beep(1000, 50);
582 }
583
584 static void
585 gdk_win32_display_flush (GdkDisplay * display)
586 {
587   g_return_if_fail (display == _gdk_display);
588
589   GdiFlush ();
590 }
591
592
593 static void
594 gdk_win32_display_sync (GdkDisplay * display)
595 {
596   g_return_if_fail (display == _gdk_display);
597
598   GdiFlush ();
599 }
600
601 static void
602 gdk_win32_display_dispose (GObject *object)
603 {
604 }
605
606 static void
607 gdk_win32_display_finalize (GObject *object)
608 {
609 }
610
611 static void
612 gdk_win32_display_init(GdkWin32Display *display)
613 {
614 }
615
616 static void
617 gdk_win32_display_before_process_all_updates (GdkDisplay  *display)
618 {
619   /* nothing */
620 }
621 static void
622 gdk_win32_display_after_process_all_updates (GdkDisplay  *display)
623 {
624   /* nothing */
625 }
626 static void
627 gdk_win32_display_notify_startup_complete (GdkDisplay  *display,
628                                            const gchar *startup_id)
629 {
630   /* nothing */
631 }
632 static void
633 gdk_win32_display_event_data_copy (GdkDisplay    *display,
634                                    const GdkEvent *src,
635                                    GdkEvent       *dst)
636 {
637   /* nothing */
638 }
639 static void
640 gdk_win32_display_event_data_free (GdkDisplay *display,
641                                    GdkEvent *event)
642 {
643   /* nothing */
644 }
645 static void
646 gdk_win32_display_push_error_trap (GdkDisplay *display)
647 {
648   /* nothing */
649 }
650 static gint
651 gdk_win32_display_pop_error_trap (GdkDisplay *display,
652                                   gboolean    ignored)
653 {
654   return 0;
655 }
656 static void
657 gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
658 {
659   GObjectClass *object_class = G_OBJECT_CLASS (klass);
660   GdkDisplayClass *display_class = GDK_DISPLAY_CLASS (klass);
661
662   object_class->dispose = gdk_win32_display_dispose;
663   object_class->finalize = gdk_win32_display_finalize;
664
665   display_class->window_type = GDK_TYPE_WIN32_WINDOW;
666
667   display_class->get_name = gdk_win32_display_get_name;
668   display_class->get_n_screens = gdk_win32_display_get_n_screens;
669   display_class->get_screen = gdk_win32_display_get_screen;
670   display_class->get_default_screen = gdk_win32_display_get_default_screen;
671   display_class->beep = gdk_win32_display_beep;
672   display_class->sync = gdk_win32_display_sync;
673   display_class->flush = gdk_win32_display_flush;
674   display_class->has_pending = _gdk_win32_display_has_pending;
675   display_class->queue_events = _gdk_win32_display_queue_events;
676   display_class->get_default_group = gdk_win32_display_get_default_group;
677
678   display_class->supports_selection_notification = gdk_win32_display_supports_selection_notification;
679   display_class->request_selection_notification = gdk_win32_display_request_selection_notification;
680   display_class->supports_clipboard_persistence = gdk_win32_display_supports_clipboard_persistence;
681   display_class->store_clipboard = gdk_win32_display_store_clipboard;
682   display_class->supports_shapes = gdk_win32_display_supports_shapes;
683   display_class->supports_input_shapes = gdk_win32_display_supports_input_shapes;
684   display_class->supports_composite = gdk_win32_display_supports_composite;
685
686   display_class->list_devices = _gdk_win32_display_list_devices;
687   //? display_class->get_app_launch_context = _gdk_win32_display_get_app_launch_context;
688   display_class->get_cursor_for_type = _gdk_win32_display_get_cursor_for_type;
689   display_class->get_cursor_for_name = _gdk_win32_display_get_cursor_for_name;
690   display_class->get_cursor_for_pixbuf = _gdk_win32_display_get_cursor_for_pixbuf;
691   display_class->get_default_cursor_size = _gdk_win32_display_get_default_cursor_size;
692   display_class->get_maximal_cursor_size = _gdk_win32_display_get_maximal_cursor_size;
693   display_class->supports_cursor_alpha = _gdk_win32_display_supports_cursor_alpha;
694   display_class->supports_cursor_color = _gdk_win32_display_supports_cursor_color;
695
696   display_class->before_process_all_updates = gdk_win32_display_before_process_all_updates;
697   display_class->after_process_all_updates = gdk_win32_display_after_process_all_updates;
698   display_class->get_next_serial = gdk_win32_display_get_next_serial;
699   display_class->notify_startup_complete = gdk_win32_display_notify_startup_complete;
700   display_class->event_data_copy = gdk_win32_display_event_data_copy;
701   display_class->event_data_free = gdk_win32_display_event_data_free;
702   display_class->create_window_impl = _gdk_win32_display_create_window_impl;
703
704   display_class->get_keymap = _gdk_win32_display_get_keymap;
705   display_class->push_error_trap = gdk_win32_display_push_error_trap;
706   display_class->pop_error_trap = gdk_win32_display_pop_error_trap;
707   display_class->get_selection_owner = _gdk_win32_display_get_selection_owner;
708   display_class->set_selection_owner = _gdk_win32_display_set_selection_owner;
709   display_class->send_selection_notify = _gdk_win32_display_send_selection_notify;
710   display_class->get_selection_property = _gdk_win32_display_get_selection_property;
711   display_class->convert_selection = _gdk_win32_display_convert_selection;
712   display_class->text_property_to_utf8_list = _gdk_win32_display_text_property_to_utf8_list;
713   display_class->utf8_to_string_target = _gdk_win32_display_utf8_to_string_target;
714 }