drag and drop
- From: hubert fauque wanadoo fr
- To: gtk-list redhat com
- Subject: drag and drop
- Date: 04 Jul 1999 07:20:34 +0200
I have sent three messages to the gtk-devel-list
but they seem to have disappeared; I don't get them
back from the list;
so I resend this message to the gtk-list:
I have found that the drop on a tree doesn't work well:
If I call gtk_drag_dest_set on the tree_items, the drop succeeds
only when it is on the first tree_item, and not when I try
to drop on the other tree_items; in fact the drop succeeds
in this case when the cursor is at some distance below the
tree_item;
I have traced the problem to gtkdnd.c in the function
gtk_drag_find_widget;
the problem comes from the fact that the tree
which is in a tree_item is not drawn inside the tree_item;
and this function seems to assume that the children of a
widget are always drawn inside this widget;
The following patch seems to solve the problem;
Hubert
*** gtkdnd-sav.c Tue Apr 13 22:20:08 1999
--- gtkdnd.c Sat Jul 3 08:20:57 1999
***************
*** 31,36 ****
--- 31,37 ----
#include "gtkmain.h"
#include "gtksignal.h"
#include "gtkwindow.h"
+ #include "gtktreeitem.h"
static GSList *drag_widgets = NULL;
static GSList *source_widgets = NULL;
***************
*** 1203,1209 ****
}
}
! if (data->toplevel ||
((data->x >= new_allocation.x) && (data->y >= new_allocation.y) &&
(data->x < new_allocation.x + new_allocation.width) &&
(data->y < new_allocation.y + new_allocation.height)))
--- 1204,1210 ----
}
}
! if (GTK_IS_TREE_ITEM(widget) || data->toplevel ||
((data->x >= new_allocation.x) && (data->y >= new_allocation.y) &&
(data->x < new_allocation.x + new_allocation.width) &&
(data->y < new_allocation.y + new_allocation.height)))
***************
*** 1215,1222 ****
{
GtkDragFindData new_data = *data;
! new_data.x -= x_offset;
! new_data.y -= y_offset;
new_data.found = FALSE;
new_data.toplevel = FALSE;
--- 1216,1226 ----
{
GtkDragFindData new_data = *data;
! if (!GTK_IS_TREE_ITEM(widget))
! {
! new_data.x -= x_offset;
! new_data.y -= y_offset;
! }
new_data.found = FALSE;
new_data.toplevel = FALSE;
***************
*** 1231,1252 ****
* emit "drag_motion" to check if we are actually in
* a drop site.
*/
! if (!data->found &&
! gtk_object_get_data (GTK_OBJECT (widget), "gtk-drag-dest"))
{
! data->found = data->callback (widget,
! data->context,
! data->x - new_allocation.x,
! data->y - new_allocation.y,
! data->time);
! /* If so, send a "drag_leave" to the last widget */
! if (data->found)
{
! if (data->info->widget && data->info->widget != widget)
{
! gtk_drag_dest_leave (data->info->widget, data->context, data->time);
}
- data->info->widget = widget;
}
}
}
--- 1235,1262 ----
* emit "drag_motion" to check if we are actually in
* a drop site.
*/
! if (!GTK_IS_TREE_ITEM(widget) || data->toplevel ||
! ((data->x >= new_allocation.x) && (data->y >= new_allocation.y) &&
! (data->x < new_allocation.x + new_allocation.width) &&
! (data->y < new_allocation.y + new_allocation.height)))
{
! if (!data->found &&
! gtk_object_get_data (GTK_OBJECT (widget), "gtk-drag-dest"))
{
! data->found = data->callback (widget,
! data->context,
! data->x - new_allocation.x,
! data->y - new_allocation.y,
! data->time);
! /* If so, send a "drag_leave" to the last widget */
! if (data->found)
{
! if (data->info->widget && data->info->widget != widget)
! {
! gtk_drag_dest_leave (data->info->widget, data->context, data->time);
! }
! data->info->widget = widget;
}
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]