2013年9月3日 星期二

gtk 2.17.2+dfb drag and drop function fixed

gdkdnd-directfb.c

//refer to _gdk_windowing_window_get_pointer in gdkwindow-directfb.c
//and gdk_directfb_child_at in gdkevents-directfb.c
GdkWindow*
dnd_windowing_window_get_child (GdkWindow* node, GdkWindow* dragwin, gint x, gint y)
{
GdkWindowObject *win;
GdkWindowObject *private;
GList *list;

private = GDK_WINDOW_OBJECT (node);

for (list = private->children; list; list = list->next)
{
win = list->data;

if (GDK_WINDOW_IS_MAPPED (win)
&&
x >= win->x
&&
x < win->x + GDK_DRAWABLE_IMPL_DIRECTFB (win->impl)->width
&&
y >= win->y
&&
y < win->y + GDK_DRAWABLE_IMPL_DIRECTFB (win->impl)->height)
{
if(GDK_WINDOW(win) != dragwin)
return dnd_windowing_window_get_child(GDK_WINDOW(win), dragwin, x-win->x, y-win->y);
}
}

return node;
}

GdkWindow*
dnd_windowing_window_get_pointer (GdkWindow *drag_window, gint x, gint y)
{
GdkWindow *child;
GdkWindow *parent;

child = dnd_windowing_window_get_child(_gdk_parent_root, drag_window, x, y);
parent = gdk_window_get_parent(child);

while( parent != NULL && GDK_WINDOW_DFB_ID(parent) <= 0 )
{
parent = gdk_window_get_parent(parent);
}

return parent;
}

void
gdk_drag_find_window_for_screen (GdkDragContext *context,
GdkWindow *drag_window,
GdkScreen *screen,
gint x_root,
gint y_root,
GdkWindow **dest_window,
GdkDragProtocol *protocol)
{
GdkWindow *dest;

g_return_if_fail (context != NULL);

//dest = gdk_window_get_pointer (NULL, &x_root, &y_root, NULL);
dest = dnd_windowing_window_get_pointer (drag_window, x_root, y_root);

if (context->dest_window != dest)
{
guint32 recipient;

//if( (recipient = gdk_drag_get_protocol(GDK_WINDOW_DFB_ID(dest), protocol)) )
if( dest != NULL && (recipient = gdk_drag_get_protocol(GDK_WINDOW_DFB_ID(dest), protocol)) )
{
*dest_window = gdk_window_lookup ((GdkNativeWindow) recipient);

if (*dest_window)
g_object_ref (*dest_window);
}
else
{
*dest_window = NULL;
}
}
else
{
*dest_window = context->dest_window;

if (*dest_window)
g_object_ref (*dest_window);

*protocol = context->protocol;
}
}

/////////////////
Download: http://www.mediafire.com/download/89zs973sz7jb97v/gtk%2B-2.17.2_fix_dnd.zip

沒有留言:

張貼留言