Re: DnD through in-proc plug/sockets



On Wed, 2004-01-21 at 19:28, Owen Taylor wrote:
> On Wed, 2004-01-21 at 12:22, Alexander Larsson wrote:
> > I have a problem with dnd in nautilus. It seems that drag_motion in the
> > icon and list views are called with the wrong coordinates. Tracing
> > through the recursive calls in gtk_drag_find_widget() it seems
> > everything goes wrong in the BonoboPlug (which is a GtkPlug
> > essentially). The coordinates returned from gdk_window_get_position for
> > it seems to be the absolute position of the plug.
> > 
> > I don't know what the right thing to do here is? Why is it returning the
> > absolute position? Why did this work before? Should we just check for
> > !GTK_IS_PLUG in addition to !GTK_WIDGET_NO_WINDOW in
> > gtk_drag_find_widget? 
> 
> This sounds like some sort of GDK bug ... gdk_window_get_position()
> should certainly be returning relative coordinates for that window,
> which when is reparented into a local window, is basically just
> a GDK_WINDOW_CHILD.

That was the problem. It wasn't a GDK_WINDOW_CHILD, it was a
GDK_WINDOW_TOPLEVEL, so the configure notify event handling set its
position. The reason it was a toplevel and not a child was that gtkplug
creates it thus, and then reparents it into the socket, and the
reparenting just isn't turning it into a child. The cause of this is the
patch from bug #117579. 

I'm not sure of all the details about toplevels, but I'm pretty sure
this is the right patch:

Index: x11/gdkwindow-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkwindow-x11.c,v
retrieving revision 1.198
diff -u -p -r1.198 gdkwindow-x11.c
--- x11/gdkwindow-x11.c	21 Dec 2003 16:37:43 -0000	1.198
+++ x11/gdkwindow-x11.c	22 Jan 2004 10:20:00 -0000
@@ -103,7 +103,7 @@ static gpointer parent_class = NULL;
 
 #define WINDOW_IS_TOPLEVEL(window)		   \
   (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD && \
-   GDK_WINDOW_TYPE (window) != GDK_WINDOW_TOPLEVEL)
+   GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN)
 
 GType
 gdk_window_impl_x11_get_type (void)


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a globe-trotting chivalrous firefighter who must take medication to keep 
him sane. She's a beautiful nymphomaniac nun married to the Mob. They fight 
crime! 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]