+ /* If 'surface_info_key' had been public we would have had a
+ portable way to find the GdkWindow of a Cairo surface. */
+
+#ifdef GDK_WINDOWING_X11
+ Display* display = cairo_xlib_surface_get_display (surface);
+ Drawable window = cairo_xlib_surface_get_drawable (surface);
+ if (display && window)
+ return gdk_window_lookup_for_display (window, display);
+ else
+ return NULL;
+#elif defined (G_OS_WIN32)
+ HDC hdc = cairo_win32_surface_get_dc (surface);
+ if (hdc)
+ return gdk_window_lookup (hdc);
+ else
+ return NULL;
+#else
+ return NULL;
+#endif