1 /* GDK - The GIMP Drawing Kit
4 * Copyright 2001 Sun Microsystems Inc.
6 * Erwann Chenede <erwann.chenede@sun.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
32 #include "gdkdisplay.h"
33 #include "gdkdisplay-x11.h"
34 #include "gdkscreen.h"
35 #include "gdkscreen-x11.h"
36 #include "gdkinternals.h"
37 #include "gdkinputprivate.h"
38 #include "xsettings-client.h"
40 #include <X11/Xatom.h>
43 #include <X11/XKBlib.h>
47 #include <X11/extensions/Xfixes.h>
50 static void gdk_display_x11_class_init (GdkDisplayX11Class *class);
51 static void gdk_display_x11_dispose (GObject *object);
52 static void gdk_display_x11_finalize (GObject *object);
55 static void gdk_internal_connection_watch (Display *display,
59 XPointer *watch_data);
60 #endif /* HAVE_X11R6 */
62 static gpointer parent_class = NULL;
64 /* Note that we never *directly* use WM_LOCALE_NAME, WM_PROTOCOLS,
65 * but including them here has the side-effect of getting them
66 * into the internal Xlib cache
68 static const char *const precache_atoms[] = {
82 "_NET_WM_STATE_STICKY",
83 "_NET_WM_STATE_MAXIMIZED_VERT",
84 "_NET_WM_STATE_MAXIMIZED_HORZ",
85 "_NET_WM_STATE_FULLSCREEN",
86 "_NET_WM_WINDOW_TYPE",
87 "_NET_WM_WINDOW_TYPE_NORMAL",
92 _gdk_display_x11_get_type (void)
94 static GType object_type = 0;
98 static const GTypeInfo object_info =
100 sizeof (GdkDisplayX11Class),
101 (GBaseInitFunc) NULL,
102 (GBaseFinalizeFunc) NULL,
103 (GClassInitFunc) gdk_display_x11_class_init,
104 NULL, /* class_finalize */
105 NULL, /* class_data */
106 sizeof (GdkDisplayX11),
108 (GInstanceInitFunc) NULL,
111 object_type = g_type_register_static (GDK_TYPE_DISPLAY,
120 gdk_display_x11_class_init (GdkDisplayX11Class * class)
122 GObjectClass *object_class = G_OBJECT_CLASS (class);
124 object_class->dispose = gdk_display_x11_dispose;
125 object_class->finalize = gdk_display_x11_finalize;
127 parent_class = g_type_class_peek_parent (class);
132 * @display_name: the name of the display to open
133 * @returns: a #GdkDisplay, or %NULL if the display
134 * could not be opened.
141 gdk_display_open (const gchar *display_name)
145 GdkDisplayX11 *display_x11;
149 const char *sm_client_id;
151 XClassHint *class_hint;
156 xdisplay = XOpenDisplay (display_name);
160 display = g_object_new (GDK_TYPE_DISPLAY_X11, NULL);
161 display_x11 = GDK_DISPLAY_X11 (display);
163 display_x11->use_xshm = TRUE;
164 display_x11->xdisplay = xdisplay;
167 /* Set up handlers for Xlib internal connections */
168 XAddConnectionWatch (xdisplay, gdk_internal_connection_watch, NULL);
169 #endif /* HAVE_X11R6 */
171 /* initialize the display's screens */
172 display_x11->screens = g_new (GdkScreen *, ScreenCount (display_x11->xdisplay));
173 for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
174 display_x11->screens[i] = _gdk_x11_screen_new (display, i);
176 /* We need to initialize events after we have the screen
177 * structures in places
179 for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
180 _gdk_x11_events_init_screen (display_x11->screens[i]);
182 /*set the default screen */
183 display_x11->default_screen = display_x11->screens[DefaultScreen (display_x11->xdisplay)];
185 attr.window_type = GDK_WINDOW_TOPLEVEL;
186 attr.wclass = GDK_INPUT_OUTPUT;
193 display_x11->leader_gdk_window = gdk_window_new (GDK_SCREEN_X11 (display_x11->default_screen)->root_window,
194 &attr, GDK_WA_X | GDK_WA_Y);
195 display_x11->leader_window = GDK_WINDOW_XID (display_x11->leader_gdk_window);
197 display_x11->leader_window_title_set = FALSE;
199 display_x11->have_render = GDK_UNKNOWN;
202 if (XFixesQueryExtension (display_x11->xdisplay,
203 &display_x11->xfixes_event_base,
206 display_x11->have_xfixes = TRUE;
208 gdk_x11_register_standard_event_type (display,
209 display_x11->xfixes_event_base,
214 display_x11->have_xfixes = FALSE;
216 if (_gdk_synchronize)
217 XSynchronize (display_x11->xdisplay, True);
219 _gdk_x11_precache_atoms (display, precache_atoms, G_N_ELEMENTS (precache_atoms));
221 class_hint = XAllocClassHint();
222 class_hint->res_name = g_get_prgname ();
224 class_hint->res_class = (char *)gdk_get_program_class ();
225 _gdk_get_command_line_args (&argc, &argv);
226 XmbSetWMProperties (display_x11->xdisplay,
227 display_x11->leader_window,
228 NULL, NULL, argv, argc, NULL, NULL,
232 sm_client_id = _gdk_get_sm_client_id ();
234 _gdk_windowing_display_set_sm_client_id (display, sm_client_id);
237 XChangeProperty (display_x11->xdisplay,
238 display_x11->leader_window,
239 gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_PID"),
240 XA_CARDINAL, 32, PropModeReplace, (guchar *) & pid, 1);
242 /* We don't yet know a valid time. */
243 display_x11->user_time = 0;
247 gint xkb_major = XkbMajorVersion;
248 gint xkb_minor = XkbMinorVersion;
249 if (XkbLibraryVersion (&xkb_major, &xkb_minor))
251 xkb_major = XkbMajorVersion;
252 xkb_minor = XkbMinorVersion;
254 if (XkbQueryExtension (display_x11->xdisplay,
255 NULL, &display_x11->xkb_event_type, NULL,
256 &xkb_major, &xkb_minor))
258 Bool detectable_autorepeat_supported;
260 display_x11->use_xkb = TRUE;
262 XkbSelectEvents (display_x11->xdisplay,
264 XkbNewKeyboardNotifyMask | XkbMapNotifyMask | XkbStateNotifyMask,
265 XkbNewKeyboardNotifyMask | XkbMapNotifyMask | XkbStateNotifyMask);
267 XkbSetDetectableAutoRepeat (display_x11->xdisplay,
269 &detectable_autorepeat_supported);
271 GDK_NOTE (MISC, g_message ("Detectable autorepeat %s.",
272 detectable_autorepeat_supported ?
273 "supported" : "not supported"));
275 display_x11->have_xkb_autorepeat = detectable_autorepeat_supported;
281 _gdk_windowing_image_init (display);
282 _gdk_events_init (display);
283 _gdk_input_init (display);
284 _gdk_dnd_init (display);
286 g_signal_emit_by_name (gdk_display_manager_get(),
287 "display_opened", display);
294 * XLib internal connection handling
296 typedef struct _GdkInternalConnection GdkInternalConnection;
298 struct _GdkInternalConnection
306 process_internal_connection (GIOChannel *gioc,
310 GdkInternalConnection *connection = (GdkInternalConnection *)data;
312 GDK_THREADS_ENTER ();
314 XProcessInternalConnection ((Display*)connection->display, connection->fd);
316 GDK_THREADS_LEAVE ();
321 static GdkInternalConnection *
322 gdk_add_connection_handler (Display *display,
325 GIOChannel *io_channel;
326 GdkInternalConnection *connection;
328 connection = g_new (GdkInternalConnection, 1);
331 connection->display = display;
333 io_channel = g_io_channel_unix_new (fd);
335 connection->source = g_io_create_watch (io_channel, G_IO_IN);
336 g_source_set_callback (connection->source,
337 (GSourceFunc)process_internal_connection, connection, NULL);
338 g_source_attach (connection->source, NULL);
340 g_io_channel_unref (io_channel);
346 gdk_remove_connection_handler (GdkInternalConnection *connection)
348 g_source_destroy (connection->source);
353 gdk_internal_connection_watch (Display *display,
357 XPointer *watch_data)
360 *watch_data = (XPointer)gdk_add_connection_handler (display, fd);
362 gdk_remove_connection_handler ((GdkInternalConnection *)*watch_data);
364 #endif /* HAVE_X11R6 */
367 * gdk_display_get_name:
368 * @display: a #GdkDisplay
370 * Gets the name of the display.
372 * Returns: a string representing the display name. This string is owned
373 * by GDK and should not be modified or freed.
377 G_CONST_RETURN gchar *
378 gdk_display_get_name (GdkDisplay * display)
380 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
382 return (gchar *) DisplayString (GDK_DISPLAY_X11 (display)->xdisplay);
386 * gdk_display_get_n_screens:
387 * @display: a #GdkDisplay
389 * Gets the number of screen managed by the @display.
391 * Returns: number of screens.
396 gdk_display_get_n_screens (GdkDisplay * display)
398 g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
400 return ScreenCount (GDK_DISPLAY_X11 (display)->xdisplay);
404 * gdk_display_get_screen:
405 * @display: a #GdkDisplay
406 * @screen_num: the screen number
408 * Returns a screen object for one of the screens of the display.
410 * Returns: the #GdkScreen object
415 gdk_display_get_screen (GdkDisplay * display, gint screen_num)
417 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
418 g_return_val_if_fail (ScreenCount (GDK_DISPLAY_X11 (display)->xdisplay) > screen_num, NULL);
420 return GDK_DISPLAY_X11 (display)->screens[screen_num];
424 * gdk_display_get_default_screen:
425 * @display: a #GdkDisplay
427 * Get the default #GdkScreen for @display.
429 * Returns: the default #GdkScreen object for @display
434 gdk_display_get_default_screen (GdkDisplay * display)
436 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
438 return GDK_DISPLAY_X11 (display)->default_screen;
442 _gdk_x11_display_is_root_window (GdkDisplay *display,
445 GdkDisplayX11 *display_x11;
448 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
450 display_x11 = GDK_DISPLAY_X11 (display);
452 for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
454 if (GDK_SCREEN_XROOTWIN (display_x11->screens[i]) == xroot_window)
461 * gdk_display_pointer_ungrab:
462 * @display: a #GdkDisplay.
463 * @time_: a timestap (e.g. GDK_CURRENT_TIME).
465 * Release any pointer grab.
470 gdk_display_pointer_ungrab (GdkDisplay *display,
475 g_return_if_fail (GDK_IS_DISPLAY (display));
477 xdisplay = GDK_DISPLAY_XDISPLAY (display);
479 _gdk_input_ungrab_pointer (display, time);
480 XUngrabPointer (xdisplay, time);
483 GDK_DISPLAY_X11 (display)->pointer_xgrab_window = NULL;
487 * gdk_display_pointer_is_grabbed:
488 * @display: a #GdkDisplay
490 * Test if the pointer is grabbed.
492 * Returns: %TRUE if an active X pointer grab is in effect
497 gdk_display_pointer_is_grabbed (GdkDisplay * display)
499 g_return_val_if_fail (GDK_IS_DISPLAY (display), TRUE);
501 return (GDK_DISPLAY_X11 (display)->pointer_xgrab_window != NULL);
505 * gdk_display_keyboard_ungrab:
506 * @display: a #GdkDisplay.
507 * @time_: a timestap (e.g #GDK_CURRENT_TIME).
509 * Release any keyboard grab
514 gdk_display_keyboard_ungrab (GdkDisplay *display,
519 g_return_if_fail (GDK_IS_DISPLAY (display));
521 xdisplay = GDK_DISPLAY_XDISPLAY (display);
523 XUngrabKeyboard (xdisplay, time);
526 GDK_DISPLAY_X11 (display)->keyboard_xgrab_window = NULL;
531 * @display: a #GdkDisplay
533 * Emits a short beep on @display
538 gdk_display_beep (GdkDisplay * display)
540 g_return_if_fail (GDK_IS_DISPLAY (display));
542 XBell (GDK_DISPLAY_XDISPLAY (display), 0);
547 * @display: a #GdkDisplay
549 * Flushes any requests queued for the windowing system and waits until all
550 * requests have been handled. This is often used for making sure that the
551 * display is synchronized with the current state of the program. Calling
552 * gdk_display_sync() before gdk_error_trap_pop() makes sure that any errors
553 * generated from earlier requests are handled before the error trap is
556 * This is most useful for X11. On windowing systems where requests are
557 * handled synchronously, this function will do nothing.
562 gdk_display_sync (GdkDisplay * display)
564 g_return_if_fail (GDK_IS_DISPLAY (display));
566 XSync (GDK_DISPLAY_XDISPLAY (display), False);
571 * @display: a #GdkDisplay
573 * Flushes any requests queued for the windowing system; this happens automatically
574 * when the main loop blocks waiting for new events, but if your application
575 * is drawing without returning control to the main loop, you may need
576 * to call this function explicitely. A common case where this function
577 * needs to be called is when an application is executing drawing commands
578 * from a thread other than the thread where the main loop is running.
580 * This is most useful for X11. On windowing systems where requests are
581 * handled synchronously, this function will do nothing.
586 gdk_display_flush (GdkDisplay *display)
588 g_return_if_fail (GDK_IS_DISPLAY (display));
590 if (!display->closed)
591 XFlush (GDK_DISPLAY_XDISPLAY (display));
595 * gdk_display_get_default_group:
596 * @display: a #GdkDisplay
598 * Returns the default group leader window for all toplevel windows
599 * on @display. This window is implicitly created by GDK.
600 * See gdk_window_set_group().
602 * Return value: The default group leader window for @display
606 GdkWindow *gdk_display_get_default_group (GdkDisplay *display)
608 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
610 return GDK_DISPLAY_X11 (display)->leader_gdk_window;
614 * gdk_x11_display_grab:
615 * @display: a #GdkDisplay
617 * Call XGrabServer() on @display.
618 * To ungrab the display again, use gdk_x11_display_ungrab().
620 * gdk_x11_display_grab()/gdk_x11_display_ungrab() calls can be nested.
625 gdk_x11_display_grab (GdkDisplay * display)
627 GdkDisplayX11 *display_x11;
629 g_return_if_fail (GDK_IS_DISPLAY (display));
631 display_x11 = GDK_DISPLAY_X11 (display);
633 if (display_x11->grab_count == 0)
634 XGrabServer (display_x11->xdisplay);
635 display_x11->grab_count++;
639 * gdk_x11_display_ungrab:
640 * @display: a #GdkDisplay
642 * Ungrab @display after it has been grabbed with
643 * gdk_x11_display_grab().
648 gdk_x11_display_ungrab (GdkDisplay * display)
650 GdkDisplayX11 *display_x11;
652 g_return_if_fail (GDK_IS_DISPLAY (display));
654 display_x11 = GDK_DISPLAY_X11 (display);;
655 g_return_if_fail (display_x11->grab_count > 0);
657 display_x11->grab_count--;
658 if (display_x11->grab_count == 0)
660 XUngrabServer (display_x11->xdisplay);
661 XFlush (display_x11->xdisplay);
666 gdk_display_x11_dispose (GObject *object)
668 GdkDisplayX11 *display_x11;
671 display_x11 = GDK_DISPLAY_X11 (object);
673 for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
674 _gdk_screen_close (display_x11->screens[i]);
676 g_source_destroy (display_x11->event_source);
678 XCloseDisplay (display_x11->xdisplay);
679 display_x11->xdisplay = NULL;
681 G_OBJECT_CLASS (parent_class)->dispose (object);
685 gdk_display_x11_finalize (GObject *object)
687 GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (object);
690 /* FIXME need to write GdkKeymap finalize fct
691 g_object_unref (display_x11->keymap);
694 if (display_x11->motif_target_lists)
696 for (i = 0; i < display_x11->motif_n_target_lists; i++)
697 g_list_free (display_x11->motif_target_lists[i]);
698 g_free (display_x11->motif_target_lists);
702 g_hash_table_destroy (display_x11->atom_from_virtual);
703 g_hash_table_destroy (display_x11->atom_to_virtual);
705 XDestroyWindow (display_x11->xdisplay, display_x11->leader_window);
706 /* list of filters for client messages */
707 g_list_free (display_x11->client_filters);
708 /* List of event window extraction functions */
709 g_slist_foreach (display_x11->event_types, (GFunc)g_free, NULL);
710 g_slist_free (display_x11->event_types);
712 g_hash_table_destroy (display_x11->xid_ht);
713 /* input GdkDevice list */
714 /* FIXME need to write finalize fct */
715 for (tmp = display_x11->input_devices; tmp; tmp = tmp->next)
716 g_object_unref (tmp->data);
717 g_list_free (display_x11->input_devices);
718 /* input GdkWindow list */
719 for (tmp = display_x11->input_windows; tmp; tmp = tmp->next)
720 g_object_unref (tmp->data);
721 g_list_free (display_x11->input_windows);
722 /* Free all GdkScreens */
723 for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
724 g_object_unref (display_x11->screens[i]);
725 g_free (display_x11->screens);
726 g_free (display_x11->startup_notification_id);
728 G_OBJECT_CLASS (parent_class)->finalize (object);
732 * gdk_x11_lookup_xdisplay:
733 * @xdisplay: a pointer to an X Display
735 * Find the #GdkDisplay corresponding to @display, if any exists.
737 * Return value: the #GdkDisplay, if found, otherwise %NULL.
742 gdk_x11_lookup_xdisplay (Display *xdisplay)
746 for (tmp_list = _gdk_displays; tmp_list; tmp_list = tmp_list->next)
748 if (GDK_DISPLAY_XDISPLAY (tmp_list->data) == xdisplay)
749 return tmp_list->data;
756 * _gdk_x11_display_screen_for_xrootwin:
757 * @display: a #Display
758 * @xrootwin: window ID for one of of the screen's of the display.
760 * Given the root window ID of one of the screen's of a #GdkDisplay,
763 * Return value: the #GdkScreen corresponding to @xrootwin, or %NULL.
766 _gdk_x11_display_screen_for_xrootwin (GdkDisplay *display,
771 n_screens = gdk_display_get_n_screens (display);
772 for (i = 0; i < n_screens; i++)
774 GdkScreen *screen = gdk_display_get_screen (display, i);
775 if (GDK_SCREEN_XROOTWIN (screen) == xrootwin)
783 * gdk_x11_display_get_xdisplay:
784 * @display: a #GdkDisplay
785 * @returns: an X display.
787 * Returns the X display of a #GdkDisplay.
792 gdk_x11_display_get_xdisplay (GdkDisplay *display)
794 return GDK_DISPLAY_X11 (display)->xdisplay;
798 _gdk_windowing_set_default_display (GdkDisplay *display)
800 GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display);
801 const gchar *startup_id;
804 gdk_display = GDK_DISPLAY_XDISPLAY (display);
808 g_free (display_x11->startup_notification_id);
809 display_x11->startup_notification_id = NULL;
811 startup_id = g_getenv ("DESKTOP_STARTUP_ID");
812 if (startup_id && *startup_id != '\0')
814 if (!g_utf8_validate (startup_id, -1, NULL))
815 g_warning ("DESKTOP_STARTUP_ID contains invalid UTF-8");
817 display_x11->startup_notification_id = g_strdup (startup_id);
819 /* Clear the environment variable so it won't be inherited by
820 * child processes and confuse things.
822 g_unsetenv ("DESKTOP_STARTUP_ID");
824 /* Set the startup id on the leader window so it
825 * applies to all windows we create on this display
827 XChangeProperty (display_x11->xdisplay,
828 display_x11->leader_window,
829 gdk_x11_get_xatom_by_name_for_display (display, "_NET_STARTUP_ID"),
830 gdk_x11_get_xatom_by_name_for_display (display, "UTF8_STRING"), 8,
832 startup_id, strlen (startup_id));
837 escape_for_xmessage (const char *str)
842 retval = g_string_new (NULL);
852 g_string_append_c (retval, '\\');
856 g_string_append_c (retval, *p);
860 return g_string_free (retval, FALSE);
864 broadcast_xmessage (GdkDisplay *display,
865 const char *message_type,
866 const char *message_type_begin,
869 Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
870 GdkScreen *screen = gdk_display_get_default_screen (display);
871 GdkWindow *root_window = gdk_screen_get_root_window (screen);
872 Window xroot_window = GDK_WINDOW_XID (root_window);
875 Atom type_atom_begin;
879 XSetWindowAttributes attrs;
881 attrs.override_redirect = True;
882 attrs.event_mask = PropertyChangeMask | StructureNotifyMask;
885 XCreateWindow (xdisplay,
892 CWOverrideRedirect | CWEventMask,
896 type_atom = gdk_x11_get_xatom_by_name_for_display (display,
898 type_atom_begin = gdk_x11_get_xatom_by_name_for_display (display,
908 xevent.xclient.type = ClientMessage;
909 xevent.xclient.message_type = type_atom_begin;
910 xevent.xclient.display =xdisplay;
911 xevent.xclient.window = xwindow;
912 xevent.xclient.format = 8;
915 src_end = message + strlen (message) + 1; /* +1 to include nul byte */
917 while (src != src_end)
919 dest = &xevent.xclient.data.b[0];
920 dest_end = dest + 20;
922 while (dest != dest_end &&
930 while (dest != dest_end)
936 XSendEvent (xdisplay,
942 xevent.xclient.message_type = type_atom;
946 XDestroyWindow (xdisplay, xwindow);
951 * gdk_notify_startup_complete:
953 * Indicates to the GUI environment that the application has finished
954 * loading. If the applications opens windows, this function is
955 * normally called after opening the application's initial set of
958 * GTK+ will call this function automatically after opening the first
959 * #GtkWindow unless gtk_window_set_auto_startup_notification() is called
960 * to disable that feature.
965 gdk_notify_startup_complete (void)
968 GdkDisplayX11 *display_x11;
972 display = gdk_display_get_default ();
976 display_x11 = GDK_DISPLAY_X11 (display);
978 if (display_x11->startup_notification_id == NULL)
981 escaped_id = escape_for_xmessage (display_x11->startup_notification_id);
982 message = g_strdup_printf ("remove: ID=%s", escaped_id);
985 broadcast_xmessage (display,
987 "_NET_STARTUP_INFO_BEGIN",
995 * gdk_display_supports_selection_notification:
996 * @display: a #GdkDisplay
998 * Returns whether #GdkEventOwnerChange events will be
999 * sent when the owner of a selection changes.
1001 * Return value: whether #GdkEventOwnerChange events will
1007 gdk_display_supports_selection_notification (GdkDisplay *display)
1009 GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display);
1011 return display_x11->have_xfixes;
1015 * gdk_display_request_selection_notification:
1016 * @display: a #GdkDisplay
1017 * @selection: the #GdkAtom naming the selection for which
1018 * ownership change notification is requested
1020 * Request #GdkEventOwnerChange events for ownership changes
1021 * of the selection named by the given atom.
1023 * Return value: whether #GdkEventOwnerChange events will
1028 gboolean gdk_display_request_selection_notification (GdkDisplay *display,
1033 GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display);
1036 if (display_x11->have_xfixes)
1038 atom = gdk_x11_atom_to_xatom_for_display (display,
1040 XFixesSelectSelectionInput (display_x11->xdisplay,
1041 display_x11->leader_window,
1043 XFixesSetSelectionOwnerNotifyMask |
1044 XFixesSelectionWindowDestroyNotifyMask |
1045 XFixesSelectionClientCloseNotifyMask);