gdk: Drop gdk_window_reparent
We're not currently using this, and dropping it allows us to loose a bunch of code which leads us towards the goal of having GdkWindow only for toplevels (and reparenting makes not sense for toplevels).
This commit is contained in:
@@ -503,15 +503,6 @@ gdk_window_broadway_move_resize (GdkWindow *window,
|
||||
window->resize_count++;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_window_broadway_reparent (GdkWindow *window,
|
||||
GdkWindow *new_parent,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_window_broadway_raise (GdkWindow *window)
|
||||
{
|
||||
@@ -1495,7 +1486,6 @@ gdk_window_impl_broadway_class_init (GdkWindowImplBroadwayClass *klass)
|
||||
impl_class->lower = gdk_window_broadway_lower;
|
||||
impl_class->restack_toplevel = gdk_window_broadway_restack_toplevel;
|
||||
impl_class->move_resize = gdk_window_broadway_move_resize;
|
||||
impl_class->reparent = gdk_window_broadway_reparent;
|
||||
impl_class->set_device_cursor = gdk_window_broadway_set_device_cursor;
|
||||
impl_class->get_geometry = gdk_window_broadway_get_geometry;
|
||||
impl_class->get_root_coords = gdk_window_broadway_get_root_coords;
|
||||
|
||||
221
gdk/gdkwindow.c
221
gdk/gdkwindow.c
@@ -1288,227 +1288,6 @@ gdk_window_new_input (GdkWindow *parent,
|
||||
return gdk_window_new (parent, &attr);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_parent_of (GdkWindow *parent,
|
||||
GdkWindow *child)
|
||||
{
|
||||
GdkWindow *w;
|
||||
|
||||
w = child;
|
||||
while (w != NULL)
|
||||
{
|
||||
if (w == parent)
|
||||
return TRUE;
|
||||
|
||||
w = gdk_window_get_parent (w);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
change_impl (GdkWindow *private,
|
||||
GdkWindow *impl_window,
|
||||
GdkWindowImpl *new)
|
||||
{
|
||||
GList *l;
|
||||
GdkWindow *child;
|
||||
GdkWindowImpl *old_impl;
|
||||
GdkWindow *old_impl_window;
|
||||
|
||||
old_impl = private->impl;
|
||||
old_impl_window = private->impl_window;
|
||||
if (private != impl_window)
|
||||
private->impl_window = g_object_ref (impl_window);
|
||||
else
|
||||
private->impl_window = private;
|
||||
private->impl = g_object_ref (new);
|
||||
if (old_impl_window != private)
|
||||
g_object_unref (old_impl_window);
|
||||
g_object_unref (old_impl);
|
||||
|
||||
for (l = private->children; l != NULL; l = l->next)
|
||||
{
|
||||
child = l->data;
|
||||
|
||||
g_assert (child->impl == old_impl); /* All children should be the same impl */
|
||||
|
||||
change_impl (child, impl_window, new);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_window_reparent:
|
||||
* @window: a #GdkWindow
|
||||
* @new_parent: new parent to move @window into
|
||||
* @x: X location inside the new parent
|
||||
* @y: Y location inside the new parent
|
||||
*
|
||||
* Reparents @window into the given @new_parent. The window being
|
||||
* reparented will be unmapped as a side effect.
|
||||
*
|
||||
**/
|
||||
void
|
||||
gdk_window_reparent (GdkWindow *window,
|
||||
GdkWindow *new_parent,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
GdkWindow *old_parent;
|
||||
GdkScreen *screen;
|
||||
gboolean show, was_mapped;
|
||||
GdkEventMask old_native_event_mask;
|
||||
GdkWindowImplClass *impl_class;
|
||||
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
g_return_if_fail (new_parent == NULL || GDK_IS_WINDOW (new_parent));
|
||||
g_return_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_ROOT);
|
||||
|
||||
if (GDK_WINDOW_DESTROYED (window) ||
|
||||
(new_parent && GDK_WINDOW_DESTROYED (new_parent)))
|
||||
return;
|
||||
|
||||
screen = gdk_window_get_screen (window);
|
||||
if (!new_parent)
|
||||
new_parent = gdk_screen_get_root_window (screen);
|
||||
|
||||
/* Don't allow reparenting to/from toplevel status */
|
||||
if (!gdk_window_is_toplevel (window) && (new_parent->window_type == GDK_WINDOW_ROOT ||
|
||||
new_parent->window_type == GDK_WINDOW_FOREIGN))
|
||||
{
|
||||
g_warning ("Can't reparent to toplevel");
|
||||
return;
|
||||
}
|
||||
|
||||
if (gdk_window_is_toplevel (window) && (new_parent->window_type != GDK_WINDOW_ROOT ||
|
||||
new_parent->window_type != GDK_WINDOW_FOREIGN))
|
||||
{
|
||||
g_warning ("Can't reparent from toplevel");
|
||||
return;
|
||||
}
|
||||
|
||||
/* No input-output children of input-only windows */
|
||||
if (new_parent->input_only && !window->input_only)
|
||||
return;
|
||||
|
||||
/* Don't create loops in hierarchy */
|
||||
if (is_parent_of (window, new_parent))
|
||||
return;
|
||||
|
||||
impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
|
||||
old_parent = window->parent;
|
||||
|
||||
was_mapped = GDK_WINDOW_IS_MAPPED (window);
|
||||
|
||||
old_native_event_mask = 0;
|
||||
if (gdk_window_has_impl (window))
|
||||
{
|
||||
/* This shouldn't happen, check anyway to see if that ever fails */
|
||||
g_assert (new_parent->window_type == GDK_WINDOW_ROOT ||
|
||||
new_parent->window_type == GDK_WINDOW_FOREIGN);
|
||||
|
||||
old_native_event_mask = get_native_event_mask (window);
|
||||
/* Native window */
|
||||
show = impl_class->reparent (window, new_parent, x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This shouldn't happen, check anyway to see if that ever fails */
|
||||
g_assert (new_parent->window_type != GDK_WINDOW_ROOT &&
|
||||
new_parent->window_type != GDK_WINDOW_FOREIGN);
|
||||
|
||||
show = was_mapped;
|
||||
gdk_window_hide (window);
|
||||
|
||||
change_impl (window,
|
||||
new_parent->impl_window,
|
||||
new_parent->impl);
|
||||
}
|
||||
|
||||
/* From here on, we treat parents of type GDK_WINDOW_FOREIGN like
|
||||
* the root window
|
||||
*/
|
||||
if (GDK_WINDOW_TYPE (new_parent) == GDK_WINDOW_FOREIGN)
|
||||
{
|
||||
new_parent = gdk_screen_get_root_window (screen);
|
||||
}
|
||||
|
||||
if (old_parent)
|
||||
old_parent->children = g_list_remove_link (old_parent->children, &window->children_list_node);
|
||||
|
||||
window->parent = new_parent;
|
||||
window->x = x;
|
||||
window->y = y;
|
||||
|
||||
new_parent->children = g_list_concat (&window->children_list_node, new_parent->children);
|
||||
|
||||
/* Switch the window type as appropriate */
|
||||
|
||||
switch (GDK_WINDOW_TYPE (new_parent))
|
||||
{
|
||||
case GDK_WINDOW_ROOT:
|
||||
case GDK_WINDOW_FOREIGN:
|
||||
if (window->toplevel_window_type != -1)
|
||||
GDK_WINDOW_TYPE (window) = window->toplevel_window_type;
|
||||
else if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD)
|
||||
GDK_WINDOW_TYPE (window) = GDK_WINDOW_TOPLEVEL;
|
||||
break;
|
||||
case GDK_WINDOW_TOPLEVEL:
|
||||
case GDK_WINDOW_CHILD:
|
||||
case GDK_WINDOW_TEMP:
|
||||
if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD && \
|
||||
GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN)
|
||||
{
|
||||
/* Save the original window type so we can restore it if the
|
||||
* window is reparented back to be a toplevel
|
||||
*/
|
||||
window->toplevel_window_type = GDK_WINDOW_TYPE (window);
|
||||
GDK_WINDOW_TYPE (window) = GDK_WINDOW_CHILD;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we changed the window type, we might have to set or
|
||||
* unset the frame clock on the window
|
||||
*/
|
||||
if (GDK_WINDOW_TYPE (new_parent) == GDK_WINDOW_ROOT &&
|
||||
GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN)
|
||||
{
|
||||
if (window->frame_clock == NULL)
|
||||
{
|
||||
GdkFrameClock *frame_clock = g_object_new (GDK_TYPE_FRAME_CLOCK_IDLE, NULL);
|
||||
gdk_window_set_frame_clock (window, frame_clock);
|
||||
g_object_unref (frame_clock);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (window->frame_clock != NULL)
|
||||
{
|
||||
g_object_run_dispose (G_OBJECT (window->frame_clock));
|
||||
gdk_window_set_frame_clock (window, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* We might have changed window type for a native windows, so we
|
||||
need to change the event mask too. */
|
||||
if (gdk_window_has_impl (window))
|
||||
{
|
||||
GdkEventMask native_event_mask = get_native_event_mask (window);
|
||||
|
||||
if (native_event_mask != old_native_event_mask)
|
||||
impl_class->set_events (window, native_event_mask);
|
||||
}
|
||||
|
||||
_gdk_window_update_viewable (window);
|
||||
|
||||
recompute_visible_regions (window, FALSE);
|
||||
|
||||
if (show)
|
||||
gdk_window_show_unraised (window);
|
||||
else
|
||||
_gdk_synthesize_crossing_events_for_geometry_change (window);
|
||||
}
|
||||
|
||||
/**
|
||||
* _gdk_event_filter_unref:
|
||||
* @window: (allow-none): A #GdkWindow, or %NULL to be the global window
|
||||
|
||||
@@ -471,11 +471,6 @@ void gdk_window_move_resize (GdkWindow *window,
|
||||
gint width,
|
||||
gint height);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_window_reparent (GdkWindow *window,
|
||||
GdkWindow *new_parent,
|
||||
gint x,
|
||||
gint y);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_window_raise (GdkWindow *window);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_window_lower (GdkWindow *window);
|
||||
|
||||
@@ -84,11 +84,6 @@ struct _GdkWindowImplClass
|
||||
GdkEventMask (* get_events) (GdkWindow *window);
|
||||
void (* set_events) (GdkWindow *window,
|
||||
GdkEventMask event_mask);
|
||||
|
||||
gboolean (* reparent) (GdkWindow *window,
|
||||
GdkWindow *new_parent,
|
||||
gint x,
|
||||
gint y);
|
||||
|
||||
void (* set_device_cursor) (GdkWindow *window,
|
||||
GdkDevice *device,
|
||||
|
||||
@@ -870,16 +870,6 @@ gdk_mir_window_impl_set_events (GdkWindow *window,
|
||||
/* We send all events and let GDK decide */
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_window_impl_reparent (GdkWindow *window,
|
||||
GdkWindow *new_parent,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
//g_printerr ("gdk_mir_window_impl_reparent window=%p new-parent=%p\n", window, new_parent);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_window_impl_set_device_cursor (GdkWindow *window,
|
||||
GdkDevice *device,
|
||||
@@ -1672,7 +1662,6 @@ gdk_mir_window_impl_class_init (GdkMirWindowImplClass *klass)
|
||||
impl_class->move_to_rect = gdk_mir_window_impl_move_to_rect;
|
||||
impl_class->get_events = gdk_mir_window_impl_get_events;
|
||||
impl_class->set_events = gdk_mir_window_impl_set_events;
|
||||
impl_class->reparent = gdk_mir_window_impl_reparent;
|
||||
impl_class->set_device_cursor = gdk_mir_window_impl_set_device_cursor;
|
||||
impl_class->get_geometry = gdk_mir_window_impl_get_geometry;
|
||||
impl_class->get_root_coords = gdk_mir_window_impl_get_root_coords;
|
||||
|
||||
@@ -946,12 +946,6 @@ gdk_quartz_window_destroy (GdkWindow *window,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_quartz_window_destroy_foreign (GdkWindow *window)
|
||||
{
|
||||
/* Foreign windows aren't supported in OSX. */
|
||||
}
|
||||
|
||||
/* FIXME: This might be possible to simplify with client-side windows. Also
|
||||
* note that already_mapped is not used yet, see the x11 backend.
|
||||
*/
|
||||
@@ -1290,54 +1284,6 @@ gdk_window_quartz_move_resize (GdkWindow *window,
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME: This might need fixing (reparenting didn't work before client-side
|
||||
* windows either).
|
||||
*/
|
||||
static gboolean
|
||||
gdk_window_quartz_reparent (GdkWindow *window,
|
||||
GdkWindow *new_parent,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
GdkWindow *old_parent;
|
||||
GdkWindowImplQuartz *impl, *old_parent_impl, *new_parent_impl;
|
||||
NSView *view, *new_parent_view;
|
||||
|
||||
if (new_parent == _gdk_root)
|
||||
{
|
||||
/* Could be added, just needs implementing. */
|
||||
g_warning ("Reparenting to root window is not supported yet in the Mac OS X backend");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
|
||||
view = impl->view;
|
||||
|
||||
new_parent_impl = GDK_WINDOW_IMPL_QUARTZ (new_parent->impl);
|
||||
new_parent_view = new_parent_impl->view;
|
||||
|
||||
old_parent = window->parent;
|
||||
old_parent_impl = GDK_WINDOW_IMPL_QUARTZ (old_parent->impl);
|
||||
|
||||
[view retain];
|
||||
|
||||
[view removeFromSuperview];
|
||||
[new_parent_view addSubview:view];
|
||||
|
||||
[view release];
|
||||
|
||||
window->parent = new_parent;
|
||||
|
||||
if (old_parent)
|
||||
{
|
||||
old_parent_impl->sorted_children = g_list_remove (old_parent_impl->sorted_children, window);
|
||||
}
|
||||
|
||||
new_parent_impl->sorted_children = g_list_prepend (new_parent_impl->sorted_children, window);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Get the toplevel ordering from NSApp and update our own list. We do
|
||||
* this on demand since the NSApp’s list is not up to date directly
|
||||
* after we get windowDidBecomeMain.
|
||||
@@ -2794,7 +2740,6 @@ gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass)
|
||||
impl_class->lower = gdk_window_quartz_lower;
|
||||
impl_class->restack_toplevel = gdk_window_quartz_restack_toplevel;
|
||||
impl_class->move_resize = gdk_window_quartz_move_resize;
|
||||
impl_class->reparent = gdk_window_quartz_reparent;
|
||||
impl_class->set_device_cursor = gdk_window_quartz_set_device_cursor;
|
||||
impl_class->get_geometry = gdk_window_quartz_get_geometry;
|
||||
impl_class->get_root_coords = gdk_window_quartz_get_root_coords;
|
||||
@@ -2802,7 +2747,6 @@ gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass)
|
||||
impl_class->shape_combine_region = gdk_window_quartz_shape_combine_region;
|
||||
impl_class->input_shape_combine_region = gdk_window_quartz_input_shape_combine_region;
|
||||
impl_class->destroy = gdk_quartz_window_destroy;
|
||||
impl_class->destroy_foreign = gdk_quartz_window_destroy_foreign;
|
||||
impl_class->begin_paint = gdk_window_impl_quartz_begin_paint;
|
||||
impl_class->get_scale_factor = gdk_quartz_window_get_scale_factor;
|
||||
|
||||
|
||||
@@ -2656,15 +2656,6 @@ gdk_window_wayland_move_to_rect (GdkWindow *window,
|
||||
impl->position_method = POSITION_METHOD_MOVE_TO_RECT;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_window_wayland_reparent (GdkWindow *window,
|
||||
GdkWindow *new_parent,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_window_wayland_set_device_cursor (GdkWindow *window,
|
||||
GdkDevice *device,
|
||||
@@ -3597,7 +3588,6 @@ _gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass)
|
||||
impl_class->restack_toplevel = gdk_window_wayland_restack_toplevel;
|
||||
impl_class->move_resize = gdk_window_wayland_move_resize;
|
||||
impl_class->move_to_rect = gdk_window_wayland_move_to_rect;
|
||||
impl_class->reparent = gdk_window_wayland_reparent;
|
||||
impl_class->set_device_cursor = gdk_window_wayland_set_device_cursor;
|
||||
impl_class->get_geometry = gdk_window_wayland_get_geometry;
|
||||
impl_class->get_root_coords = gdk_window_wayland_get_root_coords;
|
||||
|
||||
@@ -1628,95 +1628,6 @@ gdk_win32_window_move_resize (GdkWindow *window,
|
||||
_gdk_win32_emit_configure_event (window);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_win32_window_reparent (GdkWindow *window,
|
||||
GdkWindow *new_parent,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
GdkScreen *screen;
|
||||
GdkWindowImplWin32 *impl;
|
||||
gboolean new_parent_is_root;
|
||||
gboolean was_toplevel;
|
||||
LONG style;
|
||||
|
||||
screen = gdk_window_get_screen (window);
|
||||
|
||||
if (!new_parent)
|
||||
{
|
||||
new_parent = gdk_screen_get_root_window (screen);
|
||||
new_parent_is_root = TRUE;
|
||||
}
|
||||
else
|
||||
new_parent_is_root = (gdk_screen_get_root_window (screen) == new_parent);
|
||||
|
||||
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
||||
|
||||
GDK_NOTE (MISC, g_print ("gdk_win32_window_reparent: %p: %p\n",
|
||||
GDK_WINDOW_HWND (window),
|
||||
GDK_WINDOW_HWND (new_parent)));
|
||||
|
||||
style = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
|
||||
|
||||
was_toplevel = GetAncestor (GDK_WINDOW_HWND (window), GA_PARENT) == GetDesktopWindow ();
|
||||
if (was_toplevel && !new_parent_is_root)
|
||||
{
|
||||
/* Reparenting from top-level (child of desktop). Clear out
|
||||
* decorations.
|
||||
*/
|
||||
style &= ~(WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX);
|
||||
style |= WS_CHILD;
|
||||
SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE, style);
|
||||
}
|
||||
else if (new_parent_is_root)
|
||||
{
|
||||
/* Reparenting to top-level. Add decorations. */
|
||||
style &= ~(WS_CHILD);
|
||||
style |= WS_OVERLAPPEDWINDOW;
|
||||
SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE, style);
|
||||
}
|
||||
|
||||
API_CALL (SetParent, (GDK_WINDOW_HWND (window),
|
||||
GDK_WINDOW_HWND (new_parent)));
|
||||
|
||||
/* From here on, we treat parents of type GDK_WINDOW_FOREIGN like
|
||||
* the root window
|
||||
*/
|
||||
if (GDK_WINDOW_TYPE (new_parent) == GDK_WINDOW_FOREIGN)
|
||||
new_parent = gdk_screen_get_root_window (screen);
|
||||
|
||||
window->parent = new_parent;
|
||||
|
||||
/* Switch the window type as appropriate */
|
||||
|
||||
switch (GDK_WINDOW_TYPE (new_parent))
|
||||
{
|
||||
case GDK_WINDOW_ROOT:
|
||||
if (impl->toplevel_window_type != -1)
|
||||
GDK_WINDOW_TYPE (window) = impl->toplevel_window_type;
|
||||
else if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD)
|
||||
GDK_WINDOW_TYPE (window) = GDK_WINDOW_TOPLEVEL;
|
||||
break;
|
||||
|
||||
case GDK_WINDOW_TOPLEVEL:
|
||||
case GDK_WINDOW_CHILD:
|
||||
case GDK_WINDOW_TEMP:
|
||||
if (WINDOW_IS_TOPLEVEL (window))
|
||||
{
|
||||
/* Save the original window type so we can restore it if the
|
||||
* window is reparented back to be a toplevel.
|
||||
*/
|
||||
impl->toplevel_window_type = GDK_WINDOW_TYPE (window);
|
||||
GDK_WINDOW_TYPE (window) = GDK_WINDOW_CHILD;
|
||||
}
|
||||
}
|
||||
|
||||
/* Move window into desired position while keeping the same client area */
|
||||
gdk_win32_window_move_resize (window, TRUE, x, y, window->width, window->height);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_window_raise (GdkWindow *window)
|
||||
{
|
||||
@@ -6011,7 +5922,6 @@ gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass)
|
||||
impl_class->lower = gdk_win32_window_lower;
|
||||
impl_class->restack_toplevel = gdk_win32_window_restack_toplevel;
|
||||
impl_class->move_resize = gdk_win32_window_move_resize;
|
||||
impl_class->reparent = gdk_win32_window_reparent;
|
||||
impl_class->set_device_cursor = gdk_win32_window_set_device_cursor;
|
||||
impl_class->get_geometry = gdk_win32_window_get_geometry;
|
||||
impl_class->get_device_state = gdk_window_win32_get_device_state;
|
||||
|
||||
@@ -1699,79 +1699,6 @@ _gdk_x11_window_set_window_scale (GdkWindow *window,
|
||||
gdk_window_invalidate_rect (window, NULL, TRUE);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_window_x11_reparent (GdkWindow *window,
|
||||
GdkWindow *new_parent,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
GdkWindowImplX11 *impl;
|
||||
|
||||
impl = GDK_WINDOW_IMPL_X11 (window->impl);
|
||||
|
||||
XReparentWindow (GDK_WINDOW_XDISPLAY (window),
|
||||
GDK_WINDOW_XID (window),
|
||||
GDK_WINDOW_XID (new_parent),
|
||||
(new_parent->abs_x + x) * impl->window_scale,
|
||||
(new_parent->abs_y + y) * impl->window_scale);
|
||||
|
||||
if (WINDOW_IS_TOPLEVEL (window))
|
||||
connect_frame_clock (window);
|
||||
else
|
||||
/* old frame clock was disposed, our signal handlers removed */
|
||||
impl->frame_clock_connected = FALSE;
|
||||
|
||||
if (GDK_WINDOW_TYPE (new_parent) == GDK_WINDOW_FOREIGN)
|
||||
new_parent = gdk_screen_get_root_window (GDK_WINDOW_SCREEN (window));
|
||||
|
||||
window->parent = new_parent;
|
||||
|
||||
/* Switch the window type as appropriate */
|
||||
|
||||
switch (GDK_WINDOW_TYPE (new_parent))
|
||||
{
|
||||
case GDK_WINDOW_ROOT:
|
||||
case GDK_WINDOW_FOREIGN:
|
||||
/* Reparenting to toplevel */
|
||||
|
||||
if (!WINDOW_IS_TOPLEVEL (window) &&
|
||||
GDK_WINDOW_TYPE (new_parent) == GDK_WINDOW_FOREIGN)
|
||||
{
|
||||
/* This is also done in common code at a later stage, but we
|
||||
need it in setup_toplevel, so do it here too */
|
||||
if (window->toplevel_window_type != -1)
|
||||
GDK_WINDOW_TYPE (window) = window->toplevel_window_type;
|
||||
else if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD)
|
||||
GDK_WINDOW_TYPE (window) = GDK_WINDOW_TOPLEVEL;
|
||||
|
||||
/* Wasn't a toplevel, set up */
|
||||
setup_toplevel_window (window, new_parent);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case GDK_WINDOW_TOPLEVEL:
|
||||
case GDK_WINDOW_CHILD:
|
||||
case GDK_WINDOW_TEMP:
|
||||
if (WINDOW_IS_TOPLEVEL (window) &&
|
||||
impl->toplevel)
|
||||
{
|
||||
if (impl->toplevel->focus_window)
|
||||
{
|
||||
XDestroyWindow (GDK_WINDOW_XDISPLAY (window), impl->toplevel->focus_window);
|
||||
_gdk_x11_display_remove_window (GDK_WINDOW_DISPLAY (window), impl->toplevel->focus_window);
|
||||
}
|
||||
|
||||
gdk_toplevel_x11_free_contents (GDK_WINDOW_DISPLAY (window),
|
||||
impl->toplevel);
|
||||
g_free (impl->toplevel);
|
||||
impl->toplevel = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_window_x11_raise (GdkWindow *window)
|
||||
{
|
||||
@@ -5127,7 +5054,6 @@ gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
|
||||
impl_class->lower = gdk_window_x11_lower;
|
||||
impl_class->restack_toplevel = gdk_window_x11_restack_toplevel;
|
||||
impl_class->move_resize = gdk_window_x11_move_resize;
|
||||
impl_class->reparent = gdk_window_x11_reparent;
|
||||
impl_class->set_device_cursor = gdk_window_x11_set_device_cursor;
|
||||
impl_class->get_geometry = gdk_window_x11_get_geometry;
|
||||
impl_class->get_root_coords = gdk_window_x11_get_root_coords;
|
||||
|
||||
Reference in New Issue
Block a user