x11: Remove gdk_x11_surface_foreign_new_for_display()
authorBenjamin Otte <otte@redhat.com>
Fri, 15 Jun 2018 06:38:19 +0000 (08:38 +0200)
committerBenjamin Otte <otte@redhat.com>
Mon, 18 Jun 2018 21:49:53 +0000 (23:49 +0200)
People who want to use foreign windows should use X directly.

docs/reference/gdk/gdk4-sections.txt
gdk/x11/gdksurface-x11.c
gdk/x11/gdkx11surface.h

index 4e80fc717a188eb017e40030e969a8060711dd33..21d1ed2934f631694e5b6236257befc771e0cfa4 100644 (file)
@@ -849,7 +849,6 @@ gdk_x11_screen_lookup_visual
 gdk_x11_screen_supports_net_wm_hint
 gdk_x11_screen_get_number_of_desktops
 gdk_x11_screen_get_current_desktop
-gdk_x11_surface_foreign_new_for_display
 gdk_x11_surface_lookup_for_display
 gdk_x11_surface_get_xid
 gdk_x11_surface_set_theme_variant
index 1b677a7786a0f5f09fdd60e42978af841ae91987..96eba372740d6abae47ff46844931f4865cadee9 100644 (file)
@@ -987,101 +987,6 @@ _gdk_x11_display_create_surface_impl (GdkDisplay    *display,
   gdk_surface_freeze_toplevel_updates (surface);
 }
 
-/**
- * gdk_x11_surface_foreign_new_for_display:
- * @display: (type GdkX11Display): the #GdkDisplay where the window handle comes from.
- * @window: an Xlib Window
- *
- * Wraps a native window in a #GdkSurface. The function will try to
- * look up the window using gdk_x11_surface_lookup_for_display() first.
- * If it does not find it there, it will create a new window.
- *
- * This may fail if the window has been destroyed. If the window
- * was already known to GDK, a new reference to the existing
- * #GdkSurface is returned.
- *
- * Returns: (transfer full): a #GdkSurface wrapper for the native
- *   window, or %NULL if the window has been destroyed. The wrapper
- *   will be newly created, if one doesn’t exist already.
- */
-GdkSurface *
-gdk_x11_surface_foreign_new_for_display (GdkDisplay *display,
-                                        Window      window)
-{
-  GdkX11Screen *screen;
-  GdkSurface *win;
-  GdkSurfaceImplX11 *impl;
-  GdkX11Display *display_x11;
-  XWindowAttributes attrs;
-  Window root, parent;
-  Window *children = NULL;
-  guint nchildren;
-  gboolean result;
-
-  g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
-
-  display_x11 = GDK_X11_DISPLAY (display);
-
-  if ((win = gdk_x11_surface_lookup_for_display (display, window)) != NULL)
-    return g_object_ref (win);
-
-  gdk_x11_display_error_trap_push (display);
-  result = XGetWindowAttributes (display_x11->xdisplay, window, &attrs);
-  if (gdk_x11_display_error_trap_pop (display) || !result)
-    return NULL;
-
-  /* FIXME: This is pretty expensive.
-   * Maybe the caller should supply the parent
-   */
-  gdk_x11_display_error_trap_push (display);
-  result = XQueryTree (display_x11->xdisplay, window, &root, &parent, &children, &nchildren);
-  if (gdk_x11_display_error_trap_pop (display) || !result)
-    return NULL;
-
-  if (children)
-    XFree (children);
-
-  screen = _gdk_x11_display_screen_for_xrootwin (display, root);
-  if (screen == NULL)
-    return NULL;
-
-  win = _gdk_display_create_surface (display);
-  win->impl = g_object_new (GDK_TYPE_SURFACE_IMPL_X11, NULL);
-  win->impl_surface = win;
-
-  impl = GDK_SURFACE_IMPL_X11 (win->impl);
-  impl->wrapper = win;
-  impl->surface_scale = GDK_X11_SCREEN (screen)->surface_scale;
-
-  /* Always treat foreigns as toplevels */
-  win->parent = NULL;
-
-  impl->xid = window;
-
-  win->x = attrs.x / impl->surface_scale;
-  win->y = attrs.y / impl->surface_scale;
-  impl->unscaled_width = attrs.width;
-  impl->unscaled_height = attrs.height;
-  win->width = attrs.width / impl->surface_scale;
-  win->height = attrs.height  / impl->surface_scale;
-  win->surface_type = GDK_SURFACE_FOREIGN;
-  win->destroyed = FALSE;
-
-  if (attrs.map_state == IsUnmapped)
-    win->state = GDK_SURFACE_STATE_WITHDRAWN;
-  else
-    win->state = 0;
-  win->viewable = TRUE;
-
-  g_object_ref (win);
-  _gdk_x11_display_add_window (display, &GDK_SURFACE_XID (win), win);
-
-  /* Update the clip region, etc */
-  _gdk_surface_update_size (win);
-
-  return win;
-}
-
 static void
 gdk_toplevel_x11_free_contents (GdkDisplay *display,
                                GdkToplevelX11 *toplevel)
index 279efed8f01b49b285db4b1cfe039cd84804d164..bb23dbee71e9aab20970eae1c9424c6ae0cb2731 100644 (file)
@@ -101,9 +101,6 @@ void     gdk_x11_surface_set_frame_sync_enabled (GdkSurface *surface,
 GDK_AVAILABLE_IN_ALL
 guint32       gdk_x11_get_server_time  (GdkSurface       *surface);
 
-GDK_AVAILABLE_IN_ALL
-GdkSurface  *gdk_x11_surface_foreign_new_for_display (GdkDisplay *display,
-                                                      Window      window);
 GDK_AVAILABLE_IN_ALL
 GdkSurface  *gdk_x11_surface_lookup_for_display      (GdkDisplay *display,
                                                       Window      window);