Only in gtk+-2.10.9-mod/gdk: .deps
Only in gtk+-2.10.9-mod/gdk/directfb: .deps
Only in gtk+-2.10.9-mod/gdk/directfb: Makefile
diff -ur gtk+-2.10.9/gdk/gdkaliasdef.c gtk+-2.10.9-mod/gdk/gdkaliasdef.c
--- gtk+-2.10.9/gdk/gdkaliasdef.c	2007-01-22 16:02:44.000000000 +0000
+++ gtk+-2.10.9-mod/gdk/gdkaliasdef.c	2007-02-20 04:21:16.000000000 +0000
@@ -2360,6 +2360,9 @@
 #undef gdk_x11_lookup_xdisplay 
 extern __typeof (gdk_x11_lookup_xdisplay) gdk_x11_lookup_xdisplay __attribute((alias("IA__gdk_x11_lookup_xdisplay"), visibility("default")));
 
+#undef gdk_x11_foreign_new_xdisplay 
+extern __typeof (gdk_x11_foreign_new_xdisplay) gdk_x11_foreign_new_xdisplay __attribute((alias("IA__gdk_x11_foreign_new_xdisplay"), visibility("default")));
+
 #endif
 #if IN_FILE(__GDK_DRAWABLE_X11_C__)
 #undef gdk_x11_drawable_get_xdisplay 
Only in gtk+-2.10.9-mod/gdk: gdkaliasdef.c~
diff -ur gtk+-2.10.9/gdk/gdkalias.h gtk+-2.10.9-mod/gdk/gdkalias.h
--- gtk+-2.10.9/gdk/gdkalias.h	2007-01-22 16:02:44.000000000 +0000
+++ gtk+-2.10.9-mod/gdk/gdkalias.h	2007-02-20 04:21:16.000000000 +0000
@@ -2357,6 +2357,9 @@
 extern __typeof (gdk_x11_lookup_xdisplay) IA__gdk_x11_lookup_xdisplay __attribute((visibility("hidden")));
 #define gdk_x11_lookup_xdisplay IA__gdk_x11_lookup_xdisplay
 
+extern __typeof (gdk_x11_foreign_new_xdisplay) IA__gdk_x11_foreign_new_xdisplay __attribute((visibility("hidden")));
+#define gdk_x11_foreign_new_xdisplay IA__gdk_x11_foreign_new_xdisplay
+
 #endif
 #if IN_FILE(__GDK_DRAWABLE_X11_C__)
 extern __typeof (gdk_x11_drawable_get_xdisplay) IA__gdk_x11_drawable_get_xdisplay __attribute((visibility("hidden")));
Only in gtk+-2.10.9-mod/gdk: gdkalias.h~
Only in gtk+-2.10.9-mod/gdk: gdkconfig.h
Only in gtk+-2.10.9-mod/gdk: gdkmarshalers.c
diff -ur gtk+-2.10.9/gdk/gdk.symbols gtk+-2.10.9-mod/gdk/gdk.symbols
--- gtk+-2.10.9/gdk/gdk.symbols	2007-01-22 15:59:33.000000000 +0000
+++ gtk+-2.10.9-mod/gdk/gdk.symbols	2007-02-20 04:02:08.000000000 +0000
@@ -1165,6 +1165,7 @@
 gdk_x11_display_grab
 gdk_x11_display_ungrab
 gdk_x11_lookup_xdisplay
+gdk_x11_foreign_new_xdisplay
 #endif
 
 #if IN_FILE(__GDK_DRAWABLE_X11_C__)
Only in gtk+-2.10.9-mod/gdk: gdk.symbols~
Only in gtk+-2.10.9-mod/gdk/linux-fb: .deps
Only in gtk+-2.10.9-mod/gdk/linux-fb: Makefile
Only in gtk+-2.10.9-mod/gdk: Makefile
Only in gtk+-2.10.9-mod/gdk/quartz: .deps
Only in gtk+-2.10.9-mod/gdk/quartz: Makefile
Only in gtk+-2.10.9-mod/gdk: stamp-gc-h
Only in gtk+-2.10.9-mod/gdk: stamp-gdkenumtypes.h
Only in gtk+-2.10.9-mod/gdk/win32: .deps
Only in gtk+-2.10.9-mod/gdk/win32: Makefile
Only in gtk+-2.10.9-mod/gdk/win32/rc: Makefile
Only in gtk+-2.10.9-mod/gdk/x11: .deps
diff -ur gtk+-2.10.9/gdk/x11/gdkdisplay-x11.c gtk+-2.10.9-mod/gdk/x11/gdkdisplay-x11.c
--- gtk+-2.10.9/gdk/x11/gdkdisplay-x11.c	2007-01-22 15:59:32.000000000 +0000
+++ gtk+-2.10.9-mod/gdk/x11/gdkdisplay-x11.c	2007-02-20 04:24:24.000000000 +0000
@@ -113,20 +113,13 @@
 {
 }
 
-/**
- * gdk_display_open:
- * @display_name: the name of the display to open
- * @returns: a #GdkDisplay, or %NULL if the display
- *  could not be opened.
- *
- * Opens a display.
- *
- * Since: 2.2
- */
-GdkDisplay *
-gdk_display_open (const gchar *display_name)
+/* Not to be used publicaly. Use foreign_new() or open().
+   Creates a GdkDisplay our of a XDisplay.
+   handle_display specifies if GDK should install event handlers
+   and proprities on the display. */
+static GdkDisplay *
+_gdk_display_new (Display *xdisplay, gboolean handle_display)
 {
-  Display *xdisplay;
   GdkDisplay *display;
   GdkDisplayX11 *display_x11;
   GdkWindowAttr attr;
@@ -142,10 +135,6 @@
   gint maj, min;
 #endif
 
-  xdisplay = XOpenDisplay (display_name);
-  if (!xdisplay)
-    return NULL;
-  
   display = g_object_new (GDK_TYPE_DISPLAY_X11, NULL);
   display_x11 = GDK_DISPLAY_X11 (display);
 
@@ -153,8 +142,10 @@
   display_x11->xdisplay = xdisplay;
 
 #ifdef HAVE_X11R6  
-  /* Set up handlers for Xlib internal connections */
-  XAddConnectionWatch (xdisplay, gdk_internal_connection_watch, NULL);
+  if (handle_display) {
+    /* Set up handlers for Xlib internal connections */
+    XAddConnectionWatch (xdisplay, gdk_internal_connection_watch, NULL);
+  }
 #endif /* HAVE_X11R6 */
   
   /* initialize the display's screens */ 
@@ -165,8 +156,9 @@
   /* We need to initialize events after we have the screen
    * structures in places
    */
-  for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
-    _gdk_x11_events_init_screen (display_x11->screens[i]);
+  if (handle_display)
+    for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
+      _gdk_x11_events_init_screen (display_x11->screens[i]);
   
   /*set the default screen */
   display_x11->default_screen = display_x11->screens[DefaultScreen (display_x11->xdisplay)];
@@ -192,7 +184,7 @@
   display_x11->have_render = GDK_UNKNOWN;
 
 #ifdef HAVE_XFIXES
-  if (XFixesQueryExtension (display_x11->xdisplay, 
+  if (handle_display && XFixesQueryExtension (display_x11->xdisplay, 
 			    &display_x11->xfixes_event_base, 
 			    &ignore))
     {
@@ -262,15 +254,17 @@
     _gdk_windowing_display_set_sm_client_id (display, sm_client_id);
 
   pid = getpid ();
-  XChangeProperty (display_x11->xdisplay,
-		   display_x11->leader_window,
-		   gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_PID"),
-		   XA_CARDINAL, 32, PropModeReplace, (guchar *) & pid, 1);
+  if (handle_display)
+    XChangeProperty (display_x11->xdisplay,
+	  	   display_x11->leader_window,
+	  	   gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_PID"),
+	  	   XA_CARDINAL, 32, PropModeReplace, (guchar *) & pid, 1);
 
   /* We don't yet know a valid time. */
   display_x11->user_time = 0;
   
 #ifdef HAVE_XKB
+  if (handle_display)
   {
     gint xkb_major = XkbMajorVersion;
     gint xkb_minor = XkbMinorVersion;
@@ -325,11 +319,13 @@
       display_x11->use_sync = TRUE;
   }
 #endif
-  
-  _gdk_windowing_image_init (display);
-  _gdk_events_init (display);
-  _gdk_input_init (display);
-  _gdk_dnd_init (display);
+
+  if (handle_display) {
+    _gdk_windowing_image_init (display);
+    _gdk_events_init (display);
+    _gdk_input_init (display);
+    _gdk_dnd_init (display);
+  }
 
   for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
     gdk_display_request_selection_notification (display, 
@@ -341,6 +337,56 @@
   return display;
 }
 
+
+/**
+ * gdk_display_open:
+ * @display_name: the name of the display to open
+ * @returns: a #GdkDisplay, or %NULL if the display
+ *  could not be opened.
+ *
+ * Opens a display.
+ *
+ * Since: 2.2
+ */
+GdkDisplay *
+gdk_display_open (const gchar *display_name)
+{
+  Display *xdisplay;
+  GdkDisplay *display;
+  GdkDisplayX11 *display_x11;
+
+  xdisplay = XOpenDisplay (display_name);
+  display = _gdk_display_new (xdisplay, TRUE);
+
+  display_x11 = GDK_DISPLAY_X11 (display);
+  display_x11->is_foreign = FALSE;
+  return display;
+}
+
+/**
+ * gdk_x11_foreign_new_xdisplay:
+ * @xdisplay: the XDisplay to wrap.
+ * @handle_display: if GDK should handle the display. That is,
+ * install event handlers and proprities on it.
+ * @returns: a #GdkDisplay.
+ *
+ * Wraps the given XDisplay into a GdkDisplay.
+ *
+ * Since:
+ */
+GdkDisplay *
+gdk_x11_foreign_new_xdisplay (Display *xdisplay, gboolean handle_display)
+{
+  GdkDisplay *display;
+  GdkDisplayX11 *display_x11;
+
+  display = _gdk_display_new (xdisplay, handle_display);
+
+  display_x11 = GDK_DISPLAY_X11 (display);
+  display_x11->is_foreign = TRUE;
+  return display;
+}
+
 #ifdef HAVE_X11R6
 /*
  * XLib internal connection handling
@@ -798,7 +844,8 @@
   /* X ID hashtable */
   g_hash_table_destroy (display_x11->xid_ht);
 
-  XCloseDisplay (display_x11->xdisplay);
+  if (!display_x11->is_foreign)
+    XCloseDisplay (display_x11->xdisplay);
 
   G_OBJECT_CLASS (_gdk_display_x11_parent_class)->finalize (object);
 }
Only in gtk+-2.10.9-mod/gdk/x11: gdkdisplay-x11.c~
diff -ur gtk+-2.10.9/gdk/x11/gdkdisplay-x11.h gtk+-2.10.9-mod/gdk/x11/gdkdisplay-x11.h
--- gtk+-2.10.9/gdk/x11/gdkdisplay-x11.h	2007-01-22 15:59:32.000000000 +0000
+++ gtk+-2.10.9-mod/gdk/x11/gdkdisplay-x11.h	2007-02-20 04:17:17.000000000 +0000
@@ -162,6 +162,10 @@
 
   /* Alpha mask picture format */
   XRenderPictFormat *mask_format;
+
+  /* When wrapping an already existing Display. Flags if
+     it is up to us to close the display or not. */
+  guint is_foreign : 1;
 };
 
 struct _GdkDisplayX11Class
Only in gtk+-2.10.9-mod/gdk/x11: gdkdisplay-x11.h~
diff -ur gtk+-2.10.9/gdk/x11/gdkx.h gtk+-2.10.9-mod/gdk/x11/gdkx.h
--- gtk+-2.10.9/gdk/x11/gdkx.h	2007-01-22 15:59:32.000000000 +0000
+++ gtk+-2.10.9-mod/gdk/x11/gdkx.h	2007-02-20 04:17:50.000000000 +0000
@@ -158,6 +158,7 @@
 #endif
 
 GdkDisplay   *gdk_x11_lookup_xdisplay (Display *xdisplay);
+GdkDisplay   *gdk_x11_foreign_new_xdisplay (Display *xdisplay, gboolean handle_display);
 
 
 /* Functions to get the X Atom equivalent to the GdkAtom */
Only in gtk+-2.10.9-mod/gdk/x11: gdkx.h~
Only in gtk+-2.10.9-mod/gdk/x11: Makefile
