]> Pileus Git - ~andy/gtk/blob - gdk/x11/gdkdisplay-x11.c
Bug 559622 – GdkDevice test segfaults
[~andy/gtk] / gdk / x11 / gdkdisplay-x11.c
1 /* GDK - The GIMP Drawing Kit
2  * gdkdisplay-x11.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 <stdlib.h>
28 #include <string.h>
29 #include <errno.h>
30 #include <unistd.h>
31
32 #include <glib.h>
33 #include "gdkx.h"
34 #include "gdkdisplay.h"
35 #include "gdkdisplay-x11.h"
36 #include "gdkscreen.h"
37 #include "gdkscreen-x11.h"
38 #include "gdkinternals.h"
39 #include "gdkinputprivate.h"
40 #include "xsettings-client.h"
41 #include "gdkalias.h"
42
43 #include <X11/Xatom.h>
44
45 #ifdef HAVE_XKB
46 #include <X11/XKBlib.h>
47 #endif
48
49 #ifdef HAVE_XFIXES
50 #include <X11/extensions/Xfixes.h>
51 #endif
52
53 #ifdef HAVE_SHAPE_EXT
54 #include <X11/extensions/shape.h>
55 #endif
56
57 #ifdef HAVE_XCOMPOSITE
58 #include <X11/extensions/Xcomposite.h>
59 #endif
60
61 #ifdef HAVE_XDAMAGE
62 #include <X11/extensions/Xdamage.h>
63 #endif
64
65 #ifdef HAVE_RANDR
66 #include <X11/extensions/Xrandr.h>
67 #endif
68
69
70 static void   gdk_display_x11_dispose            (GObject            *object);
71 static void   gdk_display_x11_finalize           (GObject            *object);
72
73 #ifdef HAVE_X11R6
74 static void gdk_internal_connection_watch (Display  *display,
75                                            XPointer  arg,
76                                            gint      fd,
77                                            gboolean  opening,
78                                            XPointer *watch_data);
79 #endif /* HAVE_X11R6 */
80
81 /* Note that we never *directly* use WM_LOCALE_NAME, WM_PROTOCOLS,
82  * but including them here has the side-effect of getting them
83  * into the internal Xlib cache
84  */
85 static const char *const precache_atoms[] = {
86   "UTF8_STRING",
87   "WM_CLIENT_LEADER",
88   "WM_DELETE_WINDOW",
89   "WM_LOCALE_NAME",
90   "WM_PROTOCOLS",
91   "WM_TAKE_FOCUS",
92   "_NET_WM_CM_S0",
93   "_NET_WM_DESKTOP",
94   "_NET_WM_ICON",
95   "_NET_WM_ICON_NAME",
96   "_NET_WM_NAME",
97   "_NET_WM_PID",
98   "_NET_WM_PING",
99   "_NET_WM_STATE",
100   "_NET_WM_STATE_STICKY",
101   "_NET_WM_STATE_MAXIMIZED_VERT",
102   "_NET_WM_STATE_MAXIMIZED_HORZ",
103   "_NET_WM_STATE_FULLSCREEN",
104   "_NET_WM_SYNC_REQUEST",
105   "_NET_WM_SYNC_REQUEST_COUNTER",
106   "_NET_WM_WINDOW_TYPE",
107   "_NET_WM_WINDOW_TYPE_NORMAL",
108   "_NET_WM_USER_TIME",
109   "_NET_VIRTUAL_ROOTS"
110 };
111
112 G_DEFINE_TYPE (GdkDisplayX11, _gdk_display_x11, GDK_TYPE_DISPLAY)
113
114 static void
115 _gdk_display_x11_class_init (GdkDisplayX11Class * class)
116 {
117   GObjectClass *object_class = G_OBJECT_CLASS (class);
118   
119   object_class->dispose = gdk_display_x11_dispose;
120   object_class->finalize = gdk_display_x11_finalize;
121 }
122
123 static void
124 _gdk_display_x11_init (GdkDisplayX11 *display)
125 {
126 }
127
128 /**
129  * gdk_display_open:
130  * @display_name: the name of the display to open
131  * @returns: a #GdkDisplay, or %NULL if the display
132  *  could not be opened.
133  *
134  * Opens a display.
135  *
136  * Since: 2.2
137  */
138 GdkDisplay *
139 gdk_display_open (const gchar *display_name)
140 {
141   Display *xdisplay;
142   GdkDisplay *display;
143   GdkDisplayX11 *display_x11;
144   GdkWindowAttr attr;
145   gint argc;
146   gchar *argv[1];
147   const char *sm_client_id;
148   
149   XClassHint *class_hint;
150   gulong pid;
151   gint i;
152 #if defined(HAVE_XFIXES) || defined(HAVE_SHAPE_EXT)
153   gint ignore;
154   gint maj, min;
155 #endif
156
157   xdisplay = XOpenDisplay (display_name);
158   if (!xdisplay)
159     return NULL;
160   
161   display = g_object_new (GDK_TYPE_DISPLAY_X11, NULL);
162   display_x11 = GDK_DISPLAY_X11 (display);
163
164   display_x11->use_xshm = TRUE;
165   display_x11->xdisplay = xdisplay;
166
167 #ifdef HAVE_X11R6  
168   /* Set up handlers for Xlib internal connections */
169   XAddConnectionWatch (xdisplay, gdk_internal_connection_watch, NULL);
170 #endif /* HAVE_X11R6 */
171   
172   /* RandR must be initialized before we initialize the screens */
173   display_x11->have_randr12 = FALSE;
174 #ifdef HAVE_RANDR
175   if (XRRQueryExtension (display_x11->xdisplay,
176                          &display_x11->xrandr_event_base, &ignore))
177   {
178       int major, minor;
179       
180       XRRQueryVersion (display_x11->xdisplay, &major, &minor);
181
182       if ((major == 1 && minor >= 2) || major > 1)
183           display_x11->have_randr12 = TRUE;
184   }
185 #endif
186   
187   /* initialize the display's screens */ 
188   display_x11->screens = g_new (GdkScreen *, ScreenCount (display_x11->xdisplay));
189   for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
190     display_x11->screens[i] = _gdk_x11_screen_new (display, i);
191
192   /* We need to initialize events after we have the screen
193    * structures in places
194    */
195   for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
196     _gdk_x11_events_init_screen (display_x11->screens[i]);
197   
198   /*set the default screen */
199   display_x11->default_screen = display_x11->screens[DefaultScreen (display_x11->xdisplay)];
200
201   attr.window_type = GDK_WINDOW_TOPLEVEL;
202   attr.wclass = GDK_INPUT_OUTPUT;
203   attr.x = 10;
204   attr.y = 10;
205   attr.width = 10;
206   attr.height = 10;
207   attr.event_mask = 0;
208
209   _gdk_x11_precache_atoms (display, precache_atoms, G_N_ELEMENTS (precache_atoms));
210
211   display_x11->leader_gdk_window = gdk_window_new (GDK_SCREEN_X11 (display_x11->default_screen)->root_window, 
212                                                    &attr, GDK_WA_X | GDK_WA_Y);
213   (_gdk_x11_window_get_toplevel (display_x11->leader_gdk_window))->is_leader = TRUE;
214
215   display_x11->leader_window = GDK_WINDOW_XID (display_x11->leader_gdk_window);
216
217   display_x11->leader_window_title_set = FALSE;
218
219   display_x11->have_render = GDK_UNKNOWN;
220
221 #ifdef HAVE_XFIXES
222   if (XFixesQueryExtension (display_x11->xdisplay, 
223                             &display_x11->xfixes_event_base, 
224                             &ignore))
225     {
226       display_x11->have_xfixes = TRUE;
227
228       gdk_x11_register_standard_event_type (display,
229                                             display_x11->xfixes_event_base, 
230                                             XFixesNumberEvents);
231     }
232   else
233 #endif
234     display_x11->have_xfixes = FALSE;
235
236 #ifdef HAVE_XCOMPOSITE
237   if (XCompositeQueryExtension (display_x11->xdisplay,
238                                 &ignore, &ignore))
239     {
240       int major, minor;
241
242       XCompositeQueryVersion (display_x11->xdisplay, &major, &minor);
243
244       /* Prior to Composite version 0.4, composited windows clipped their
245        * parents, so you had to use IncludeInferiors to draw to the parent
246        * This isn't useful for our purposes, so require 0.4
247        */
248       display_x11->have_xcomposite = major > 0 || (major == 0 && minor >= 4);
249     }
250   else
251 #endif
252     display_x11->have_xcomposite = FALSE;
253
254 #ifdef HAVE_XDAMAGE
255   if (XDamageQueryExtension (display_x11->xdisplay,
256                              &display_x11->xdamage_event_base,
257                              &ignore))
258     {
259       display_x11->have_xdamage = TRUE;
260
261       gdk_x11_register_standard_event_type (display,
262                                             display_x11->xdamage_event_base,
263                                             XDamageNumberEvents);
264     }
265   else
266 #endif
267     display_x11->have_xdamage = FALSE;
268
269   display_x11->have_shapes = FALSE;
270   display_x11->have_input_shapes = FALSE;
271 #ifdef HAVE_SHAPE_EXT
272   if (XShapeQueryExtension (GDK_DISPLAY_XDISPLAY (display), &ignore, &ignore))
273     {
274       display_x11->have_shapes = TRUE;
275 #ifdef ShapeInput             
276       if (XShapeQueryVersion (GDK_DISPLAY_XDISPLAY (display), &maj, &min))
277         display_x11->have_input_shapes = (maj == 1 && min >= 1);
278 #endif
279     }
280 #endif
281
282   display_x11->trusted_client = TRUE;
283   {
284     Window root, child;
285     int rootx, rooty, winx, winy;
286     unsigned int xmask;
287
288     gdk_error_trap_push ();
289     XQueryPointer (display_x11->xdisplay, 
290                    GDK_SCREEN_X11 (display_x11->default_screen)->xroot_window,
291                    &root, &child, &rootx, &rooty, &winx, &winy, &xmask);
292     gdk_flush ();
293     if (G_UNLIKELY (gdk_error_trap_pop () == BadWindow)) 
294       {
295         g_warning ("Connection to display %s appears to be untrusted. Pointer and keyboard grabs and inter-client communication may not work as expected.", gdk_display_get_name (display));
296         display_x11->trusted_client = FALSE;
297       }
298   }
299
300   if (_gdk_synchronize)
301     XSynchronize (display_x11->xdisplay, True);
302   
303   class_hint = XAllocClassHint();
304   class_hint->res_name = g_get_prgname ();
305   
306   class_hint->res_class = (char *)gdk_get_program_class ();
307
308   /* XmbSetWMProperties sets the RESOURCE_NAME environment variable
309    * from argv[0], so we just synthesize an argument array here.
310    */
311   argc = 1;
312   argv[0] = g_get_prgname ();
313   
314   XmbSetWMProperties (display_x11->xdisplay,
315                       display_x11->leader_window,
316                       NULL, NULL, argv, argc, NULL, NULL,
317                       class_hint);
318   XFree (class_hint);
319
320   sm_client_id = _gdk_get_sm_client_id ();
321   if (sm_client_id)
322     _gdk_windowing_display_set_sm_client_id (display, sm_client_id);
323
324   pid = getpid ();
325   XChangeProperty (display_x11->xdisplay,
326                    display_x11->leader_window,
327                    gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_PID"),
328                    XA_CARDINAL, 32, PropModeReplace, (guchar *) & pid, 1);
329
330   /* We don't yet know a valid time. */
331   display_x11->user_time = 0;
332   
333 #ifdef HAVE_XKB
334   {
335     gint xkb_major = XkbMajorVersion;
336     gint xkb_minor = XkbMinorVersion;
337     if (XkbLibraryVersion (&xkb_major, &xkb_minor))
338       {
339         xkb_major = XkbMajorVersion;
340         xkb_minor = XkbMinorVersion;
341             
342         if (XkbQueryExtension (display_x11->xdisplay, 
343                                NULL, &display_x11->xkb_event_type, NULL,
344                                &xkb_major, &xkb_minor))
345           {
346             Bool detectable_autorepeat_supported;
347             
348             display_x11->use_xkb = TRUE;
349
350             XkbSelectEvents (display_x11->xdisplay,
351                              XkbUseCoreKbd,
352                              XkbNewKeyboardNotifyMask | XkbMapNotifyMask | XkbStateNotifyMask,
353                              XkbNewKeyboardNotifyMask | XkbMapNotifyMask | XkbStateNotifyMask);
354
355             /* keep this in sync with _gdk_keymap_state_changed() */ 
356             XkbSelectEventDetails (display_x11->xdisplay,
357                                    XkbUseCoreKbd, XkbStateNotify,
358                                    XkbAllStateComponentsMask,
359                                    XkbGroupLockMask|XkbModifierLockMask);
360
361             XkbSetDetectableAutoRepeat (display_x11->xdisplay,
362                                         True,
363                                         &detectable_autorepeat_supported);
364
365             GDK_NOTE (MISC, g_message ("Detectable autorepeat %s.",
366                                        detectable_autorepeat_supported ? 
367                                        "supported" : "not supported"));
368             
369             display_x11->have_xkb_autorepeat = detectable_autorepeat_supported;
370           }
371       }
372   }
373 #endif
374
375   display_x11->use_sync = FALSE;
376 #ifdef HAVE_XSYNC
377   {
378     int major, minor;
379     int error_base, event_base;
380     
381     if (XSyncQueryExtension (display_x11->xdisplay,
382                              &event_base, &error_base) &&
383         XSyncInitialize (display_x11->xdisplay,
384                          &major, &minor))
385       display_x11->use_sync = TRUE;
386   }
387 #endif
388   
389   _gdk_windowing_image_init (display);
390   _gdk_events_init (display);
391   _gdk_input_init (display);
392   _gdk_dnd_init (display);
393
394   for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
395     gdk_display_request_selection_notification (display, 
396                                                 GDK_SCREEN_X11 (display_x11->screens[i])->cm_selection_atom);
397
398   g_signal_emit_by_name (gdk_display_manager_get(),
399                          "display_opened", display);
400
401   return display;
402 }
403
404 #ifdef HAVE_X11R6
405 /*
406  * XLib internal connection handling
407  */
408 typedef struct _GdkInternalConnection GdkInternalConnection;
409
410 struct _GdkInternalConnection
411 {
412   gint           fd;
413   GSource       *source;
414   Display       *display;
415 };
416
417 static gboolean
418 process_internal_connection (GIOChannel  *gioc,
419                              GIOCondition cond,
420                              gpointer     data)
421 {
422   GdkInternalConnection *connection = (GdkInternalConnection *)data;
423
424   GDK_THREADS_ENTER ();
425
426   XProcessInternalConnection ((Display*)connection->display, connection->fd);
427
428   GDK_THREADS_LEAVE ();
429
430   return TRUE;
431 }
432
433 static GdkInternalConnection *
434 gdk_add_connection_handler (Display *display,
435                             guint    fd)
436 {
437   GIOChannel *io_channel;
438   GdkInternalConnection *connection;
439
440   connection = g_new (GdkInternalConnection, 1);
441
442   connection->fd = fd;
443   connection->display = display;
444   
445   io_channel = g_io_channel_unix_new (fd);
446   
447   connection->source = g_io_create_watch (io_channel, G_IO_IN);
448   g_source_set_callback (connection->source,
449                          (GSourceFunc)process_internal_connection, connection, NULL);
450   g_source_attach (connection->source, NULL);
451   
452   g_io_channel_unref (io_channel);
453   
454   return connection;
455 }
456
457 static void
458 gdk_remove_connection_handler (GdkInternalConnection *connection)
459 {
460   g_source_destroy (connection->source);
461   g_free (connection);
462 }
463
464 static void
465 gdk_internal_connection_watch (Display  *display,
466                                XPointer  arg,
467                                gint      fd,
468                                gboolean  opening,
469                                XPointer *watch_data)
470 {
471   if (opening)
472     *watch_data = (XPointer)gdk_add_connection_handler (display, fd);
473   else
474     gdk_remove_connection_handler ((GdkInternalConnection *)*watch_data);
475 }
476 #endif /* HAVE_X11R6 */
477
478 /**
479  * gdk_display_get_name:
480  * @display: a #GdkDisplay
481  *
482  * Gets the name of the display.
483  * 
484  * Returns: a string representing the display name. This string is owned
485  * by GDK and should not be modified or freed.
486  * 
487  * Since: 2.2
488  */
489 G_CONST_RETURN gchar *
490 gdk_display_get_name (GdkDisplay *display)
491 {
492   g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
493   
494   return (gchar *) DisplayString (GDK_DISPLAY_X11 (display)->xdisplay);
495 }
496
497 /**
498  * gdk_display_get_n_screens:
499  * @display: a #GdkDisplay
500  *
501  * Gets the number of screen managed by the @display.
502  * 
503  * Returns: number of screens.
504  * 
505  * Since: 2.2
506  */
507 gint
508 gdk_display_get_n_screens (GdkDisplay *display)
509 {
510   g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
511   
512   return ScreenCount (GDK_DISPLAY_X11 (display)->xdisplay);
513 }
514
515 /**
516  * gdk_display_get_screen:
517  * @display: a #GdkDisplay
518  * @screen_num: the screen number
519  *
520  * Returns a screen object for one of the screens of the display.
521  *
522  * Returns: the #GdkScreen object
523  *
524  * Since: 2.2
525  */
526 GdkScreen *
527 gdk_display_get_screen (GdkDisplay *display, 
528                         gint        screen_num)
529 {
530   g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
531   g_return_val_if_fail (ScreenCount (GDK_DISPLAY_X11 (display)->xdisplay) > screen_num, NULL);
532   
533   return GDK_DISPLAY_X11 (display)->screens[screen_num];
534 }
535
536 /**
537  * gdk_display_get_default_screen:
538  * @display: a #GdkDisplay
539  *
540  * Get the default #GdkScreen for @display.
541  * 
542  * Returns: the default #GdkScreen object for @display
543  *
544  * Since: 2.2
545  */
546 GdkScreen *
547 gdk_display_get_default_screen (GdkDisplay *display)
548 {
549   g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
550   
551   return GDK_DISPLAY_X11 (display)->default_screen;
552 }
553
554 gboolean
555 _gdk_x11_display_is_root_window (GdkDisplay *display,
556                                  Window      xroot_window)
557 {
558   GdkDisplayX11 *display_x11;
559   gint i;
560   
561   g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
562   
563   display_x11 = GDK_DISPLAY_X11 (display);
564   
565   for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
566     {
567       if (GDK_SCREEN_XROOTWIN (display_x11->screens[i]) == xroot_window)
568         return TRUE;
569     }
570   return FALSE;
571 }
572
573 #define XSERVER_TIME_IS_LATER(time1, time2)                        \
574   ( (( time1 > time2 ) && ( time1 - time2 < ((guint32)-1)/2 )) ||  \
575     (( time1 < time2 ) && ( time2 - time1 > ((guint32)-1)/2 ))     \
576   )
577
578 /**
579  * gdk_display_pointer_ungrab:
580  * @display: a #GdkDisplay.
581  * @time_: a timestap (e.g. %GDK_CURRENT_TIME).
582  *
583  * Release any pointer grab.
584  *
585  * Since: 2.2
586  */
587 void
588 gdk_display_pointer_ungrab (GdkDisplay *display,
589                             guint32     time)
590 {
591   Display *xdisplay;
592   GdkDisplayX11 *display_x11;
593
594   g_return_if_fail (GDK_IS_DISPLAY (display));
595
596   display_x11 = GDK_DISPLAY_X11 (display);
597   xdisplay = GDK_DISPLAY_XDISPLAY (display);
598   
599   _gdk_input_ungrab_pointer (display, time);
600   XUngrabPointer (xdisplay, time);
601   XFlush (xdisplay);
602
603   if (time == GDK_CURRENT_TIME || 
604       display_x11->pointer_xgrab_time == GDK_CURRENT_TIME ||
605       !XSERVER_TIME_IS_LATER (display_x11->pointer_xgrab_time, time))
606     display_x11->pointer_xgrab_window = NULL;
607 }
608
609 /**
610  * gdk_display_pointer_is_grabbed:
611  * @display: a #GdkDisplay
612  *
613  * Test if the pointer is grabbed.
614  *
615  * Returns: %TRUE if an active X pointer grab is in effect
616  *
617  * Since: 2.2
618  */
619 gboolean
620 gdk_display_pointer_is_grabbed (GdkDisplay *display)
621 {
622   g_return_val_if_fail (GDK_IS_DISPLAY (display), TRUE);
623   
624   return (GDK_DISPLAY_X11 (display)->pointer_xgrab_window != NULL &&
625           !GDK_DISPLAY_X11 (display)->pointer_xgrab_implicit);
626 }
627
628 /**
629  * gdk_display_keyboard_ungrab:
630  * @display: a #GdkDisplay.
631  * @time_: a timestap (e.g #GDK_CURRENT_TIME).
632  *
633  * Release any keyboard grab
634  *
635  * Since: 2.2
636  */
637 void
638 gdk_display_keyboard_ungrab (GdkDisplay *display,
639                              guint32     time)
640 {
641   Display *xdisplay;
642   GdkDisplayX11 *display_x11;
643   
644   g_return_if_fail (GDK_IS_DISPLAY (display));
645
646   display_x11 = GDK_DISPLAY_X11 (display);
647   xdisplay = GDK_DISPLAY_XDISPLAY (display);
648   
649   XUngrabKeyboard (xdisplay, time);
650   XFlush (xdisplay);
651   
652   if (time == GDK_CURRENT_TIME || 
653       display_x11->keyboard_xgrab_time == GDK_CURRENT_TIME ||
654       !XSERVER_TIME_IS_LATER (display_x11->keyboard_xgrab_time, time))
655     display_x11->keyboard_xgrab_window = NULL;
656 }
657
658 /**
659  * gdk_display_beep:
660  * @display: a #GdkDisplay
661  *
662  * Emits a short beep on @display
663  *
664  * Since: 2.2
665  */
666 void
667 gdk_display_beep (GdkDisplay *display)
668 {
669   g_return_if_fail (GDK_IS_DISPLAY (display));
670   
671   XBell (GDK_DISPLAY_XDISPLAY (display), 0);
672 }
673
674 /**
675  * gdk_display_sync:
676  * @display: a #GdkDisplay
677  *
678  * Flushes any requests queued for the windowing system and waits until all
679  * requests have been handled. This is often used for making sure that the
680  * display is synchronized with the current state of the program. Calling
681  * gdk_display_sync() before gdk_error_trap_pop() makes sure that any errors
682  * generated from earlier requests are handled before the error trap is 
683  * removed.
684  *
685  * This is most useful for X11. On windowing systems where requests are
686  * handled synchronously, this function will do nothing.
687  *
688  * Since: 2.2
689  */
690 void
691 gdk_display_sync (GdkDisplay *display)
692 {
693   g_return_if_fail (GDK_IS_DISPLAY (display));
694   
695   XSync (GDK_DISPLAY_XDISPLAY (display), False);
696 }
697
698 /**
699  * gdk_display_flush:
700  * @display: a #GdkDisplay
701  *
702  * Flushes any requests queued for the windowing system; this happens automatically
703  * when the main loop blocks waiting for new events, but if your application
704  * is drawing without returning control to the main loop, you may need
705  * to call this function explicitely. A common case where this function
706  * needs to be called is when an application is executing drawing commands
707  * from a thread other than the thread where the main loop is running.
708  *
709  * This is most useful for X11. On windowing systems where requests are
710  * handled synchronously, this function will do nothing.
711  *
712  * Since: 2.4
713  */
714 void 
715 gdk_display_flush (GdkDisplay *display)
716 {
717   g_return_if_fail (GDK_IS_DISPLAY (display));
718
719   if (!display->closed)
720     XFlush (GDK_DISPLAY_XDISPLAY (display));
721 }
722
723 /**
724  * gdk_display_get_default_group:
725  * @display: a #GdkDisplay
726  * 
727  * Returns the default group leader window for all toplevel windows
728  * on @display. This window is implicitly created by GDK. 
729  * See gdk_window_set_group().
730  * 
731  * Return value: The default group leader window for @display
732  *
733  * Since: 2.4
734  **/
735 GdkWindow *
736 gdk_display_get_default_group (GdkDisplay *display)
737 {
738   g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
739
740   return GDK_DISPLAY_X11 (display)->leader_gdk_window;
741 }
742
743 /**
744  * gdk_x11_display_grab:
745  * @display: a #GdkDisplay 
746  * 
747  * Call XGrabServer() on @display. 
748  * To ungrab the display again, use gdk_x11_display_ungrab(). 
749  *
750  * gdk_x11_display_grab()/gdk_x11_display_ungrab() calls can be nested.
751  *
752  * Since: 2.2
753  **/
754 void
755 gdk_x11_display_grab (GdkDisplay *display)
756 {
757   GdkDisplayX11 *display_x11;
758   
759   g_return_if_fail (GDK_IS_DISPLAY (display));
760   
761   display_x11 = GDK_DISPLAY_X11 (display);
762   
763   if (display_x11->grab_count == 0)
764     XGrabServer (display_x11->xdisplay);
765   display_x11->grab_count++;
766 }
767
768 /**
769  * gdk_x11_display_ungrab:
770  * @display: a #GdkDisplay
771  * 
772  * Ungrab @display after it has been grabbed with 
773  * gdk_x11_display_grab(). 
774  *
775  * Since: 2.2
776  **/
777 void
778 gdk_x11_display_ungrab (GdkDisplay *display)
779 {
780   GdkDisplayX11 *display_x11;
781   
782   g_return_if_fail (GDK_IS_DISPLAY (display));
783   
784   display_x11 = GDK_DISPLAY_X11 (display);;
785   g_return_if_fail (display_x11->grab_count > 0);
786   
787   display_x11->grab_count--;
788   if (display_x11->grab_count == 0)
789     {
790       XUngrabServer (display_x11->xdisplay);
791       XFlush (display_x11->xdisplay);
792     }
793 }
794
795 static void
796 gdk_display_x11_dispose (GObject *object)
797 {
798   GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (object);
799   gint           i;
800
801   g_list_foreach (display_x11->input_devices, (GFunc) g_object_run_dispose, NULL);
802
803   for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
804     _gdk_screen_close (display_x11->screens[i]);
805
806   _gdk_events_uninit (GDK_DISPLAY_OBJECT (object));
807
808   G_OBJECT_CLASS (_gdk_display_x11_parent_class)->dispose (object);
809 }
810
811 static void
812 gdk_display_x11_finalize (GObject *object)
813 {
814   GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (object);
815   gint           i;
816
817   /* Keymap */
818   if (display_x11->keymap)
819     g_object_unref (display_x11->keymap);
820
821   /* Free motif Dnd */
822   if (display_x11->motif_target_lists)
823     {
824       for (i = 0; i < display_x11->motif_n_target_lists; i++)
825         g_list_free (display_x11->motif_target_lists[i]);
826       g_free (display_x11->motif_target_lists);
827     }
828
829   /* Atom Hashtable */
830   g_hash_table_destroy (display_x11->atom_from_virtual);
831   g_hash_table_destroy (display_x11->atom_to_virtual);
832
833   /* Leader Window */
834   XDestroyWindow (display_x11->xdisplay, display_x11->leader_window);
835
836   /* list of filters for client messages */
837   g_list_foreach (display_x11->client_filters, (GFunc) g_free, NULL);
838   g_list_free (display_x11->client_filters);
839
840   /* List of event window extraction functions */
841   g_slist_foreach (display_x11->event_types, (GFunc)g_free, NULL);
842   g_slist_free (display_x11->event_types);
843
844   /* input GdkDevice list */
845   g_list_foreach (display_x11->input_devices, (GFunc) g_object_unref, NULL);
846   g_list_free (display_x11->input_devices);
847
848   /* input GdkWindow list */
849   g_list_foreach (display_x11->input_windows, (GFunc) g_free, NULL);
850   g_list_free (display_x11->input_windows);
851
852   /* Free all GdkScreens */
853   for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
854     g_object_unref (display_x11->screens[i]);
855   g_free (display_x11->screens);
856
857   g_free (display_x11->startup_notification_id);
858
859   /* X ID hashtable */
860   g_hash_table_destroy (display_x11->xid_ht);
861
862   XCloseDisplay (display_x11->xdisplay);
863
864   G_OBJECT_CLASS (_gdk_display_x11_parent_class)->finalize (object);
865 }
866
867 /**
868  * gdk_x11_lookup_xdisplay:
869  * @xdisplay: a pointer to an X Display
870  * 
871  * Find the #GdkDisplay corresponding to @display, if any exists.
872  * 
873  * Return value: the #GdkDisplay, if found, otherwise %NULL.
874  *
875  * Since: 2.2
876  **/
877 GdkDisplay *
878 gdk_x11_lookup_xdisplay (Display *xdisplay)
879 {
880   GSList *tmp_list;
881
882   for (tmp_list = _gdk_displays; tmp_list; tmp_list = tmp_list->next)
883     {
884       if (GDK_DISPLAY_XDISPLAY (tmp_list->data) == xdisplay)
885         return tmp_list->data;
886     }
887   
888   return NULL;
889 }
890
891 /**
892  * _gdk_x11_display_screen_for_xrootwin:
893  * @display: a #GdkDisplay
894  * @xrootwin: window ID for one of of the screen's of the display.
895  * 
896  * Given the root window ID of one of the screen's of a #GdkDisplay,
897  * finds the screen.
898  * 
899  * Return value: the #GdkScreen corresponding to @xrootwin, or %NULL.
900  **/
901 GdkScreen *
902 _gdk_x11_display_screen_for_xrootwin (GdkDisplay *display,
903                                       Window      xrootwin)
904 {
905   gint i;
906
907   for (i = 0; i < ScreenCount (GDK_DISPLAY_X11 (display)->xdisplay); i++)
908     {
909       GdkScreen *screen = gdk_display_get_screen (display, i);
910       if (GDK_SCREEN_XROOTWIN (screen) == xrootwin)
911         return screen;
912     }
913
914   return NULL;
915 }
916
917 /**
918  * gdk_x11_display_get_xdisplay:
919  * @display: a #GdkDisplay
920  * @returns: an X display.
921  *
922  * Returns the X display of a #GdkDisplay.
923  *
924  * Since: 2.2
925  */
926 Display *
927 gdk_x11_display_get_xdisplay (GdkDisplay *display)
928 {
929   g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
930   return GDK_DISPLAY_X11 (display)->xdisplay;
931 }
932
933 void
934 _gdk_windowing_set_default_display (GdkDisplay *display)
935 {
936   GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display);
937   const gchar *startup_id;
938   
939   if (!display)
940     {
941       gdk_display = NULL;
942       return;
943     }
944
945   gdk_display = GDK_DISPLAY_XDISPLAY (display);
946
947   g_free (display_x11->startup_notification_id);
948   display_x11->startup_notification_id = NULL;
949   
950   startup_id = g_getenv ("DESKTOP_STARTUP_ID");
951   if (startup_id && *startup_id != '\0')
952     {
953       gchar *time_str;
954
955       if (!g_utf8_validate (startup_id, -1, NULL))
956         g_warning ("DESKTOP_STARTUP_ID contains invalid UTF-8");
957       else
958         display_x11->startup_notification_id = g_strdup (startup_id);
959
960       /* Find the launch time from the startup_id, if it's there.  Newer spec
961        * states that the startup_id is of the form <unique>_TIME<timestamp>
962        */
963       time_str = g_strrstr (startup_id, "_TIME");
964       if (time_str != NULL)
965         {
966           gulong retval;
967           gchar *end;
968           errno = 0;
969
970           /* Skip past the "_TIME" part */
971           time_str += 5;
972
973           retval = strtoul (time_str, &end, 0);
974           if (end != time_str && errno == 0)
975             display_x11->user_time = retval;
976         }
977       
978       /* Clear the environment variable so it won't be inherited by
979        * child processes and confuse things.  
980        */
981       g_unsetenv ("DESKTOP_STARTUP_ID");
982
983       /* Set the startup id on the leader window so it
984        * applies to all windows we create on this display
985        */
986       XChangeProperty (display_x11->xdisplay,
987                        display_x11->leader_window,
988                        gdk_x11_get_xatom_by_name_for_display (display, "_NET_STARTUP_ID"),
989                        gdk_x11_get_xatom_by_name_for_display (display, "UTF8_STRING"), 8,
990                        PropModeReplace,
991                        (guchar *)startup_id, strlen (startup_id));
992     }
993 }
994
995 static void
996 broadcast_xmessage (GdkDisplay *display,
997                     const char *message_type,
998                     const char *message_type_begin,
999                     const char *message)
1000 {
1001   Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
1002   GdkScreen *screen = gdk_display_get_default_screen (display);
1003   GdkWindow *root_window = gdk_screen_get_root_window (screen);
1004   Window xroot_window = GDK_WINDOW_XID (root_window);
1005   
1006   Atom type_atom;
1007   Atom type_atom_begin;
1008   Window xwindow;
1009
1010   if (!G_LIKELY (GDK_DISPLAY_X11 (display)->trusted_client))
1011     return;
1012
1013   {
1014     XSetWindowAttributes attrs;
1015
1016     attrs.override_redirect = True;
1017     attrs.event_mask = PropertyChangeMask | StructureNotifyMask;
1018
1019     xwindow =
1020       XCreateWindow (xdisplay,
1021                      xroot_window,
1022                      -100, -100, 1, 1,
1023                      0,
1024                      CopyFromParent,
1025                      CopyFromParent,
1026                      (Visual *)CopyFromParent,
1027                      CWOverrideRedirect | CWEventMask,
1028                      &attrs);
1029   }
1030
1031   type_atom = gdk_x11_get_xatom_by_name_for_display (display,
1032                                                      message_type);
1033   type_atom_begin = gdk_x11_get_xatom_by_name_for_display (display,
1034                                                            message_type_begin);
1035   
1036   {
1037     XClientMessageEvent xclient;
1038     const char *src;
1039     const char *src_end;
1040     char *dest;
1041     char *dest_end;
1042     
1043                 memset(&xclient, 0, sizeof (xclient));
1044     xclient.type = ClientMessage;
1045     xclient.message_type = type_atom_begin;
1046     xclient.display =xdisplay;
1047     xclient.window = xwindow;
1048     xclient.format = 8;
1049
1050     src = message;
1051     src_end = message + strlen (message) + 1; /* +1 to include nul byte */
1052     
1053     while (src != src_end)
1054       {
1055         dest = &xclient.data.b[0];
1056         dest_end = dest + 20;        
1057         
1058         while (dest != dest_end &&
1059                src != src_end)
1060           {
1061             *dest = *src;
1062             ++dest;
1063             ++src;
1064           }
1065
1066         while (dest != dest_end)
1067           {
1068             *dest = 0;
1069             ++dest;
1070           }
1071         
1072         XSendEvent (xdisplay,
1073                     xroot_window,
1074                     False,
1075                     PropertyChangeMask,
1076                     (XEvent *)&xclient);
1077
1078         xclient.message_type = type_atom;
1079       }
1080   }
1081
1082   XDestroyWindow (xdisplay, xwindow);
1083   XFlush (xdisplay);
1084 }
1085
1086 /**
1087  * gdk_x11_display_broadcast_startup_message:
1088  * @display: a #GdkDisplay
1089  * @message_type: startup notification message type ("new", "change",
1090  * or "remove")
1091  * @...: a list of key/value pairs (as strings), terminated by a
1092  * %NULL key. (A %NULL value for a key will cause that key to be
1093  * skipped in the output.)
1094  *
1095  * Sends a startup notification message of type @message_type to
1096  * @display. 
1097  *
1098  * This is a convenience function for use by code that implements the
1099  * freedesktop startup notification specification. Applications should
1100  * not normally need to call it directly. See the <ulink
1101  * url="http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt">Startup
1102  * Notification Protocol specification</ulink> for
1103  * definitions of the message types and keys that can be used.
1104  *
1105  * Since: 2.12
1106  **/
1107 void
1108 gdk_x11_display_broadcast_startup_message (GdkDisplay *display,
1109                                            const char *message_type,
1110                                            ...)
1111 {
1112   GString *message;
1113   va_list ap;
1114   const char *key, *value, *p;
1115
1116   message = g_string_new (message_type);
1117   g_string_append_c (message, ':');
1118
1119   va_start (ap, message_type);
1120   while ((key = va_arg (ap, const char *)))
1121     {
1122       value = va_arg (ap, const char *);
1123       if (!value)
1124         continue;
1125
1126       g_string_append_printf (message, " %s=\"", key);
1127       for (p = value; *p; p++)
1128         {
1129           switch (*p)
1130             {
1131             case ' ':
1132             case '"':
1133             case '\\':
1134               g_string_append_c (message, '\\');
1135               break;
1136             }
1137
1138           g_string_append_c (message, *p);
1139         }
1140       g_string_append_c (message, '\"');
1141     }
1142   va_end (ap);
1143
1144   broadcast_xmessage (display,
1145                       "_NET_STARTUP_INFO",
1146                       "_NET_STARTUP_INFO_BEGIN",
1147                       message->str);
1148
1149   g_string_free (message, TRUE);
1150 }
1151
1152 /**
1153  * gdk_notify_startup_complete:
1154  * 
1155  * Indicates to the GUI environment that the application has finished
1156  * loading. If the applications opens windows, this function is
1157  * normally called after opening the application's initial set of
1158  * windows.
1159  * 
1160  * GTK+ will call this function automatically after opening the first
1161  * #GtkWindow unless gtk_window_set_auto_startup_notification() is called 
1162  * to disable that feature.
1163  *
1164  * Since: 2.2
1165  **/
1166 void
1167 gdk_notify_startup_complete (void)
1168 {
1169   GdkDisplay *display;
1170   GdkDisplayX11 *display_x11;
1171
1172   display = gdk_display_get_default ();
1173   if (!display)
1174     return;
1175   
1176   display_x11 = GDK_DISPLAY_X11 (display);
1177
1178   if (display_x11->startup_notification_id == NULL)
1179     return;
1180
1181   gdk_notify_startup_complete_with_id (display_x11->startup_notification_id);
1182 }
1183
1184 /**
1185  * gdk_notify_startup_complete_with_id:
1186  * @startup_id: a startup-notification identifier, for which notification
1187  *              process should be completed
1188  * 
1189  * Indicates to the GUI environment that the application has finished
1190  * loading, using a given identifier.
1191  * 
1192  * GTK+ will call this function automatically for #GtkWindow with custom
1193  * startup-notification identifier unless
1194  * gtk_window_set_auto_startup_notification() is called to disable
1195  * that feature.
1196  *
1197  * Since: 2.12
1198  **/
1199 void
1200 gdk_notify_startup_complete_with_id (const gchar* startup_id)
1201 {
1202   GdkDisplay *display;
1203
1204   display = gdk_display_get_default ();
1205   if (!display)
1206     return;
1207
1208   gdk_x11_display_broadcast_startup_message (display, "remove",
1209                                              "ID", startup_id,
1210                                              NULL);
1211 }
1212
1213 /**
1214  * gdk_display_supports_selection_notification:
1215  * @display: a #GdkDisplay
1216  * 
1217  * Returns whether #GdkEventOwnerChange events will be 
1218  * sent when the owner of a selection changes.
1219  * 
1220  * Return value: whether #GdkEventOwnerChange events will 
1221  *               be sent.
1222  *
1223  * Since: 2.6
1224  **/
1225 gboolean 
1226 gdk_display_supports_selection_notification (GdkDisplay *display)
1227 {
1228   GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display);
1229
1230   return display_x11->have_xfixes;
1231 }
1232
1233 /**
1234  * gdk_display_request_selection_notification:
1235  * @display: a #GdkDisplay
1236  * @selection: the #GdkAtom naming the selection for which
1237  *             ownership change notification is requested
1238  * 
1239  * Request #GdkEventOwnerChange events for ownership changes
1240  * of the selection named by the given atom.
1241  * 
1242  * Return value: whether #GdkEventOwnerChange events will 
1243  *               be sent.
1244  *
1245  * Since: 2.6
1246  **/
1247 gboolean
1248 gdk_display_request_selection_notification (GdkDisplay *display,
1249                                             GdkAtom     selection)
1250
1251 {
1252 #ifdef HAVE_XFIXES
1253   GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display);
1254   Atom atom;
1255
1256   if (display_x11->have_xfixes)
1257     {
1258       atom = gdk_x11_atom_to_xatom_for_display (display, 
1259                                                 selection);
1260       XFixesSelectSelectionInput (display_x11->xdisplay, 
1261                                   display_x11->leader_window,
1262                                   atom,
1263                                   XFixesSetSelectionOwnerNotifyMask |
1264                                   XFixesSelectionWindowDestroyNotifyMask |
1265                                   XFixesSelectionClientCloseNotifyMask);
1266       return TRUE;
1267     }
1268   else
1269 #endif
1270     return FALSE;
1271 }
1272
1273 /**
1274  * gdk_display_supports_clipboard_persistence
1275  * @display: a #GdkDisplay
1276  *
1277  * Returns whether the speicifed display supports clipboard
1278  * persistance; i.e. if it's possible to store the clipboard data after an
1279  * application has quit. On X11 this checks if a clipboard daemon is
1280  * running.
1281  *
1282  * Returns: %TRUE if the display supports clipboard persistance.
1283  *
1284  * Since: 2.6
1285  */
1286 gboolean
1287 gdk_display_supports_clipboard_persistence (GdkDisplay *display)
1288 {
1289   Atom clipboard_manager;
1290
1291   /* It might make sense to cache this */
1292   clipboard_manager = gdk_x11_get_xatom_by_name_for_display (display, "CLIPBOARD_MANAGER");
1293   return XGetSelectionOwner (GDK_DISPLAY_X11 (display)->xdisplay, clipboard_manager) != None;
1294 }
1295
1296 /**
1297  * gdk_display_store_clipboard
1298  * @display:          a #GdkDisplay
1299  * @clipboard_window: a #GdkWindow belonging to the clipboard owner
1300  * @time_:            a timestamp
1301  * @targets:          an array of targets that should be saved, or %NULL 
1302  *                    if all available targets should be saved.
1303  * @n_targets:        length of the @targets array
1304  *
1305  * Issues a request to the clipboard manager to store the
1306  * clipboard data. On X11, this is a special program that works
1307  * according to the freedesktop clipboard specification, available at
1308  * <ulink url="http://www.freedesktop.org/Standards/clipboard-manager-spec">
1309  * http://www.freedesktop.org/Standards/clipboard-manager-spec</ulink>.
1310  *
1311  * Since: 2.6
1312  */
1313 void
1314 gdk_display_store_clipboard (GdkDisplay    *display,
1315                              GdkWindow     *clipboard_window,
1316                              guint32        time_,
1317                              const GdkAtom *targets,
1318                              gint           n_targets)
1319 {
1320   GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display);
1321   Atom clipboard_manager, save_targets;
1322   
1323   clipboard_manager = gdk_x11_get_xatom_by_name_for_display (display, "CLIPBOARD_MANAGER");
1324   save_targets = gdk_x11_get_xatom_by_name_for_display (display, "SAVE_TARGETS");
1325
1326   gdk_error_trap_push ();
1327
1328   if (XGetSelectionOwner (display_x11->xdisplay, clipboard_manager) != None)
1329     {
1330       Atom property_name = None;
1331       Atom *xatoms;
1332       int i;
1333       
1334       if (n_targets > 0)
1335         {
1336           property_name = gdk_x11_atom_to_xatom_for_display (display, _gdk_selection_property);
1337
1338           xatoms = g_new (Atom, n_targets);
1339           for (i = 0; i < n_targets; i++)
1340             xatoms[i] = gdk_x11_atom_to_xatom_for_display (display, targets[i]);
1341
1342           XChangeProperty (display_x11->xdisplay, GDK_WINDOW_XID (clipboard_window),
1343                            property_name, XA_ATOM,
1344                            32, PropModeReplace, (guchar *)xatoms, n_targets);
1345           g_free (xatoms);
1346
1347         }
1348       
1349       XConvertSelection (display_x11->xdisplay,
1350                          clipboard_manager, save_targets, property_name,
1351                          GDK_WINDOW_XID (clipboard_window), time_);
1352       
1353     }
1354   gdk_error_trap_pop ();
1355
1356 }
1357
1358 /**
1359  * gdk_x11_display_get_user_time:
1360  * @display: a #GdkDisplay
1361  *
1362  * Returns the timestamp of the last user interaction on 
1363  * @display. The timestamp is taken from events caused
1364  * by user interaction such as key presses or pointer 
1365  * movements. See gdk_x11_window_set_user_time().
1366  *
1367  * Returns: the timestamp of the last user interaction 
1368  *
1369  * Since: 2.8
1370  */
1371 guint32
1372 gdk_x11_display_get_user_time (GdkDisplay *display)
1373 {
1374   return GDK_DISPLAY_X11 (display)->user_time;
1375 }
1376
1377 /**
1378  * gdk_display_supports_shapes:
1379  * @display: a #GdkDisplay
1380  *
1381  * Returns %TRUE if gdk_window_shape_combine_mask() can
1382  * be used to create shaped windows on @display.
1383  *
1384  * Returns: %TRUE if shaped windows are supported 
1385  *
1386  * Since: 2.10
1387  */
1388 gboolean 
1389 gdk_display_supports_shapes (GdkDisplay *display)
1390 {
1391   return GDK_DISPLAY_X11 (display)->have_shapes;
1392 }
1393
1394 /**
1395  * gdk_display_supports_input_shapes:
1396  * @display: a #GdkDisplay
1397  *
1398  * Returns %TRUE if gdk_window_input_shape_combine_mask() can
1399  * be used to modify the input shape of windows on @display.
1400  *
1401  * Returns: %TRUE if windows with modified input shape are supported 
1402  *
1403  * Since: 2.10
1404  */
1405 gboolean 
1406 gdk_display_supports_input_shapes (GdkDisplay *display)
1407 {
1408   return GDK_DISPLAY_X11 (display)->have_input_shapes;
1409 }
1410
1411
1412 /**
1413  * gdk_x11_display_get_startup_notification_id:
1414  * @display: a #GdkDisplay
1415  *
1416  * Gets the startup notification ID for a display.
1417  * 
1418  * Returns: the startup notification ID for @display
1419  *
1420  * Since: 2.12
1421  */
1422 G_CONST_RETURN gchar *
1423 gdk_x11_display_get_startup_notification_id (GdkDisplay *display)
1424 {
1425   return GDK_DISPLAY_X11 (display)->startup_notification_id;
1426 }
1427
1428 /**
1429  * gdk_display_supports_composite:
1430  * @display: a #GdkDisplay
1431  *
1432  * Returns %TRUE if gdk_window_set_composited() can be used
1433  * to redirect drawing on the window using compositing.
1434  *
1435  * Currently this only works on X11 with XComposite and
1436  * XDamage extensions available.
1437  *
1438  * Returns: %TRUE if windows may be composited.
1439  *
1440  * Since: 2.12
1441  */
1442 gboolean
1443 gdk_display_supports_composite (GdkDisplay *display)
1444 {
1445   GdkDisplayX11 *x11_display = GDK_DISPLAY_X11 (display);
1446
1447   return x11_display->have_xcomposite &&
1448          x11_display->have_xdamage &&
1449          x11_display->have_xfixes;
1450 }
1451
1452
1453 #define __GDK_DISPLAY_X11_C__
1454 #include "gdkaliasdef.c"