Implement gdk_window_reparent.

2008-03-11  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkwindow-quartz.c: Implement gdk_window_reparent.

svn path=/trunk/; revision=19746
This commit is contained in:
Richard Hult 2008-03-11 10:14:47 +00:00 committed by Richard Hult
parent 980fdb08d9
commit 62f084869d
2 changed files with 47 additions and 6 deletions

View File

@ -1,3 +1,7 @@
2008-03-11 Richard Hult <richard@imendio.com>
* gdk/quartz/gdkwindow-quartz.c: Implement gdk_window_reparent.
2008-03-10 Tor Lillqvist <tml@novell.com>
* tests/teststatusicon.c (do_exit, popup_menu): Add the

View File

@ -1437,14 +1437,51 @@ gdk_window_move_resize (GdkWindow *window,
void
gdk_window_reparent (GdkWindow *window,
GdkWindow *new_parent,
gint x,
gint y)
GdkWindow *new_parent,
gint x,
gint y)
{
g_warning ("gdk_window_reparent: %p %p (%d, %d)",
window, new_parent, x, y);
GdkWindowObject *private, *old_parent_private, *new_parent_private;
GdkWindowImplQuartz *impl, *old_parent_impl, *new_parent_impl;
NSView *view, *new_parent_view;
/* FIXME: Implement */
if (!new_parent || 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;
}
private = GDK_WINDOW_OBJECT (window);
impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
view = impl->view;
new_parent_private = GDK_WINDOW_OBJECT (new_parent);
new_parent_impl = GDK_WINDOW_IMPL_QUARTZ (new_parent_private->impl);
new_parent_view = new_parent_impl->view;
old_parent_private = GDK_WINDOW_OBJECT (private->parent);
old_parent_impl = GDK_WINDOW_IMPL_QUARTZ (old_parent_private->impl);
[view retain];
[view removeFromSuperview];
[new_parent_view addSubview:view];
[view release];
private->x = x;
private->y = y;
private->parent = (GdkWindowObject *)new_parent;
if (old_parent_private)
{
old_parent_private->children = g_list_remove (old_parent_private->children, window);
old_parent_impl->sorted_children = g_list_remove (old_parent_impl->sorted_children, window);
}
new_parent_private->children = g_list_prepend (new_parent_private->children, window);
new_parent_impl->sorted_children = g_list_prepend (new_parent_impl->sorted_children, window);
}
void