Commit e248e4e7 authored by Havoc Pennington's avatar Havoc Pennington Committed by Havoc Pennington

sync to tree changes

2001-01-19  Havoc Pennington  <hp@redhat.com>

	* demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes

	* gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this
	function

	* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget):
	implement

	* gtk/gtktreeview.c (gtk_tree_view_move_to): rename
	scroll_to_cell, matches TextView scroll functions better
	(gtk_tree_view_tree_to_widget_coords): new function
	(gtk_tree_view_widget_to_tree_coords): new function
	(gtk_tree_view_get_visible_rect): new function
	(gtk_tree_view_get_path_at_pos): accept negative coordinates
	(gtk_tree_view_draw_node_focus_rect): new function moved from
	draw_focus, also, use width of bin_window as width of the focus
	rect
	(gtk_tree_view_expand_row): fix bug where it didn't recognize
	already-expanded rows
	(gtk_tree_view_get_cell_rect): new function
	(gtk_tree_view_get_path_at_pos): return the click position
	relative to the passed-in cell
	(gtk_tree_view_set_expander_column): new function

	* configure.in: remove gtk-config-2.0 chmod

	* gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups,
	and properly handle drags with targets we don't understand
	(gtk_text_view_drag_end): don't stop scrolling, the source isn't
	scrolling anyway
	(gtk_text_view_drag_drop): stop scrolling here though, and set the
	mark invisible

	* gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public
	function
	(gtk_drag_dest_get_target_list): new function
	(gtk_drag_dest_set_target_list): new function

	* gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation

	* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields
	related to drag-and-drop
parent 3da8e3c7
2001-01-19 <alexl@redhat.com>
2001-01-19 Havoc Pennington <hp@redhat.com>
* demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes
* gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this
function
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget):
implement
* gtk/gtktreeview.c (gtk_tree_view_move_to): rename
scroll_to_cell, matches TextView scroll functions better
(gtk_tree_view_tree_to_widget_coords): new function
(gtk_tree_view_widget_to_tree_coords): new function
(gtk_tree_view_get_visible_rect): new function
(gtk_tree_view_get_path_at_pos): accept negative coordinates
(gtk_tree_view_draw_node_focus_rect): new function moved from
draw_focus, also, use width of bin_window as width of the focus
rect
(gtk_tree_view_expand_row): fix bug where it didn't recognize
already-expanded rows
(gtk_tree_view_get_cell_rect): new function
(gtk_tree_view_get_path_at_pos): return the click position
relative to the passed-in cell
(gtk_tree_view_set_expander_column): new function
* configure.in: remove gtk-config-2.0 chmod
* gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups,
and properly handle drags with targets we don't understand
(gtk_text_view_drag_end): don't stop scrolling, the source isn't
scrolling anyway
(gtk_text_view_drag_drop): stop scrolling here though, and set the
mark invisible
* gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public
function
(gtk_drag_dest_get_target_list): new function
(gtk_drag_dest_set_target_list): new function
* gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields
related to drag-and-drop
2001-01-19 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkprivate-fb.h:
Define EMULATE_GDKFONT.
......@@ -67,7 +112,7 @@ Mon Jan 8 11:58:05 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkobject.h: Remove trailing , from enum
2001-01-17 <alexl@redhat.com>
2001-01-17 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_shadow_fb_draw_arc):
Doh! Mixed up x and y.
......
2001-01-19 <alexl@redhat.com>
2001-01-19 Havoc Pennington <hp@redhat.com>
* demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes
* gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this
function
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget):
implement
* gtk/gtktreeview.c (gtk_tree_view_move_to): rename
scroll_to_cell, matches TextView scroll functions better
(gtk_tree_view_tree_to_widget_coords): new function
(gtk_tree_view_widget_to_tree_coords): new function
(gtk_tree_view_get_visible_rect): new function
(gtk_tree_view_get_path_at_pos): accept negative coordinates
(gtk_tree_view_draw_node_focus_rect): new function moved from
draw_focus, also, use width of bin_window as width of the focus
rect
(gtk_tree_view_expand_row): fix bug where it didn't recognize
already-expanded rows
(gtk_tree_view_get_cell_rect): new function
(gtk_tree_view_get_path_at_pos): return the click position
relative to the passed-in cell
(gtk_tree_view_set_expander_column): new function
* configure.in: remove gtk-config-2.0 chmod
* gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups,
and properly handle drags with targets we don't understand
(gtk_text_view_drag_end): don't stop scrolling, the source isn't
scrolling anyway
(gtk_text_view_drag_drop): stop scrolling here though, and set the
mark invisible
* gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public
function
(gtk_drag_dest_get_target_list): new function
(gtk_drag_dest_set_target_list): new function
* gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields
related to drag-and-drop
2001-01-19 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkprivate-fb.h:
Define EMULATE_GDKFONT.
......@@ -67,7 +112,7 @@ Mon Jan 8 11:58:05 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkobject.h: Remove trailing , from enum
2001-01-17 <alexl@redhat.com>
2001-01-17 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_shadow_fb_draw_arc):
Doh! Mixed up x and y.
......
2001-01-19 <alexl@redhat.com>
2001-01-19 Havoc Pennington <hp@redhat.com>
* demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes
* gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this
function
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget):
implement
* gtk/gtktreeview.c (gtk_tree_view_move_to): rename
scroll_to_cell, matches TextView scroll functions better
(gtk_tree_view_tree_to_widget_coords): new function
(gtk_tree_view_widget_to_tree_coords): new function
(gtk_tree_view_get_visible_rect): new function
(gtk_tree_view_get_path_at_pos): accept negative coordinates
(gtk_tree_view_draw_node_focus_rect): new function moved from
draw_focus, also, use width of bin_window as width of the focus
rect
(gtk_tree_view_expand_row): fix bug where it didn't recognize
already-expanded rows
(gtk_tree_view_get_cell_rect): new function
(gtk_tree_view_get_path_at_pos): return the click position
relative to the passed-in cell
(gtk_tree_view_set_expander_column): new function
* configure.in: remove gtk-config-2.0 chmod
* gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups,
and properly handle drags with targets we don't understand
(gtk_text_view_drag_end): don't stop scrolling, the source isn't
scrolling anyway
(gtk_text_view_drag_drop): stop scrolling here though, and set the
mark invisible
* gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public
function
(gtk_drag_dest_get_target_list): new function
(gtk_drag_dest_set_target_list): new function
* gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields
related to drag-and-drop
2001-01-19 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkprivate-fb.h:
Define EMULATE_GDKFONT.
......@@ -67,7 +112,7 @@ Mon Jan 8 11:58:05 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkobject.h: Remove trailing , from enum
2001-01-17 <alexl@redhat.com>
2001-01-17 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_shadow_fb_draw_arc):
Doh! Mixed up x and y.
......
2001-01-19 <alexl@redhat.com>
2001-01-19 Havoc Pennington <hp@redhat.com>
* demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes
* gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this
function
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget):
implement
* gtk/gtktreeview.c (gtk_tree_view_move_to): rename
scroll_to_cell, matches TextView scroll functions better
(gtk_tree_view_tree_to_widget_coords): new function
(gtk_tree_view_widget_to_tree_coords): new function
(gtk_tree_view_get_visible_rect): new function
(gtk_tree_view_get_path_at_pos): accept negative coordinates
(gtk_tree_view_draw_node_focus_rect): new function moved from
draw_focus, also, use width of bin_window as width of the focus
rect
(gtk_tree_view_expand_row): fix bug where it didn't recognize
already-expanded rows
(gtk_tree_view_get_cell_rect): new function
(gtk_tree_view_get_path_at_pos): return the click position
relative to the passed-in cell
(gtk_tree_view_set_expander_column): new function
* configure.in: remove gtk-config-2.0 chmod
* gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups,
and properly handle drags with targets we don't understand
(gtk_text_view_drag_end): don't stop scrolling, the source isn't
scrolling anyway
(gtk_text_view_drag_drop): stop scrolling here though, and set the
mark invisible
* gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public
function
(gtk_drag_dest_get_target_list): new function
(gtk_drag_dest_set_target_list): new function
* gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields
related to drag-and-drop
2001-01-19 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkprivate-fb.h:
Define EMULATE_GDKFONT.
......@@ -67,7 +112,7 @@ Mon Jan 8 11:58:05 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkobject.h: Remove trailing , from enum
2001-01-17 <alexl@redhat.com>
2001-01-17 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_shadow_fb_draw_arc):
Doh! Mixed up x and y.
......
2001-01-19 <alexl@redhat.com>
2001-01-19 Havoc Pennington <hp@redhat.com>
* demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes
* gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this
function
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget):
implement
* gtk/gtktreeview.c (gtk_tree_view_move_to): rename
scroll_to_cell, matches TextView scroll functions better
(gtk_tree_view_tree_to_widget_coords): new function
(gtk_tree_view_widget_to_tree_coords): new function
(gtk_tree_view_get_visible_rect): new function
(gtk_tree_view_get_path_at_pos): accept negative coordinates
(gtk_tree_view_draw_node_focus_rect): new function moved from
draw_focus, also, use width of bin_window as width of the focus
rect
(gtk_tree_view_expand_row): fix bug where it didn't recognize
already-expanded rows
(gtk_tree_view_get_cell_rect): new function
(gtk_tree_view_get_path_at_pos): return the click position
relative to the passed-in cell
(gtk_tree_view_set_expander_column): new function
* configure.in: remove gtk-config-2.0 chmod
* gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups,
and properly handle drags with targets we don't understand
(gtk_text_view_drag_end): don't stop scrolling, the source isn't
scrolling anyway
(gtk_text_view_drag_drop): stop scrolling here though, and set the
mark invisible
* gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public
function
(gtk_drag_dest_get_target_list): new function
(gtk_drag_dest_set_target_list): new function
* gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields
related to drag-and-drop
2001-01-19 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkprivate-fb.h:
Define EMULATE_GDKFONT.
......@@ -67,7 +112,7 @@ Mon Jan 8 11:58:05 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkobject.h: Remove trailing , from enum
2001-01-17 <alexl@redhat.com>
2001-01-17 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_shadow_fb_draw_arc):
Doh! Mixed up x and y.
......
2001-01-19 <alexl@redhat.com>
2001-01-19 Havoc Pennington <hp@redhat.com>
* demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes
* gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this
function
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget):
implement
* gtk/gtktreeview.c (gtk_tree_view_move_to): rename
scroll_to_cell, matches TextView scroll functions better
(gtk_tree_view_tree_to_widget_coords): new function
(gtk_tree_view_widget_to_tree_coords): new function
(gtk_tree_view_get_visible_rect): new function
(gtk_tree_view_get_path_at_pos): accept negative coordinates
(gtk_tree_view_draw_node_focus_rect): new function moved from
draw_focus, also, use width of bin_window as width of the focus
rect
(gtk_tree_view_expand_row): fix bug where it didn't recognize
already-expanded rows
(gtk_tree_view_get_cell_rect): new function
(gtk_tree_view_get_path_at_pos): return the click position
relative to the passed-in cell
(gtk_tree_view_set_expander_column): new function
* configure.in: remove gtk-config-2.0 chmod
* gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups,
and properly handle drags with targets we don't understand
(gtk_text_view_drag_end): don't stop scrolling, the source isn't
scrolling anyway
(gtk_text_view_drag_drop): stop scrolling here though, and set the
mark invisible
* gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public
function
(gtk_drag_dest_get_target_list): new function
(gtk_drag_dest_set_target_list): new function
* gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields
related to drag-and-drop
2001-01-19 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkprivate-fb.h:
Define EMULATE_GDKFONT.
......@@ -67,7 +112,7 @@ Mon Jan 8 11:58:05 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkobject.h: Remove trailing , from enum
2001-01-17 <alexl@redhat.com>
2001-01-17 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_shadow_fb_draw_arc):
Doh! Mixed up x and y.
......
2001-01-19 <alexl@redhat.com>
2001-01-19 Havoc Pennington <hp@redhat.com>
* demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes
* gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this
function
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget):
implement
* gtk/gtktreeview.c (gtk_tree_view_move_to): rename
scroll_to_cell, matches TextView scroll functions better
(gtk_tree_view_tree_to_widget_coords): new function
(gtk_tree_view_widget_to_tree_coords): new function
(gtk_tree_view_get_visible_rect): new function
(gtk_tree_view_get_path_at_pos): accept negative coordinates
(gtk_tree_view_draw_node_focus_rect): new function moved from
draw_focus, also, use width of bin_window as width of the focus
rect
(gtk_tree_view_expand_row): fix bug where it didn't recognize
already-expanded rows
(gtk_tree_view_get_cell_rect): new function
(gtk_tree_view_get_path_at_pos): return the click position
relative to the passed-in cell
(gtk_tree_view_set_expander_column): new function
* configure.in: remove gtk-config-2.0 chmod
* gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups,
and properly handle drags with targets we don't understand
(gtk_text_view_drag_end): don't stop scrolling, the source isn't
scrolling anyway
(gtk_text_view_drag_drop): stop scrolling here though, and set the
mark invisible
* gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public
function
(gtk_drag_dest_get_target_list): new function
(gtk_drag_dest_set_target_list): new function
* gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields
related to drag-and-drop
2001-01-19 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkprivate-fb.h:
Define EMULATE_GDKFONT.
......@@ -67,7 +112,7 @@ Mon Jan 8 11:58:05 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkobject.h: Remove trailing , from enum
2001-01-17 <alexl@redhat.com>
2001-01-17 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_shadow_fb_draw_arc):
Doh! Mixed up x and y.
......
......@@ -1187,4 +1187,4 @@ modules/input/Makefile
contrib/Makefile
contrib/gdk-pixbuf-xlib/Makefile
contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib-2.0.pc
], [chmod +x gtk-config-2.0])
])
......@@ -245,6 +245,8 @@ button_press_event_cb (GtkTreeView *tree_view,
event->x,
event->y,
&path,
NULL,
NULL,
NULL);
if (path)
......
......@@ -187,9 +187,6 @@ static gboolean gtk_drag_highlight_expose (GtkWidget *widget,
GdkEventExpose *event,
gpointer data);
static GdkAtom gtk_drag_dest_find_target (GtkWidget *widget,
GtkDragDestSite *site,
GdkDragContext *context);
static void gtk_drag_selection_received (GtkWidget *widget,
GtkSelectionData *selection_data,
guint32 time,
......@@ -943,6 +940,58 @@ gtk_drag_dest_unset (GtkWidget *widget)
gtk_object_set_data (GTK_OBJECT (widget), "gtk-drag-dest", NULL);
}
/**
* gtk_drag_dest_get_target_list:
* @widget: a #GtkWidget
*
* Returns the list of targets this widget can accept from
* drag-and-drop.
*
* Return value: the #GtkTargetList, or %NULL if none
**/
GtkTargetList*
gtk_drag_dest_get_target_list (GtkWidget *widget)
{
GtkDragDestSite *site;
site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-drag-dest");
return site ? site->target_list : NULL;
}
/**
* gtk_drag_dest_set_target_list:
* @widget: a #GtkWidget that's a drag destination
* @target_list: list of droppable targets, or %NULL for none
*
* Sets the target types that this widget can accept from drag-and-drop.
* The widget must first be made into a drag destination with
* gtk_drag_dest_set().
**/
void
gtk_drag_dest_set_target_list (GtkWidget *widget,
GtkTargetList *target_list)
{
GtkDragDestSite *site;
site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-drag-dest");
if (site == NULL)
{
g_warning ("can't set a target list on a widget until you've called gtk_drag_dest_set() to make the widget into a drag destination");
return;
}
if (target_list)
gtk_target_list_ref (site->target_list);
if (site->target_list)
gtk_target_list_unref (site->target_list);
site->target_list = target_list;
}
/*************************************************************
* gtk_drag_dest_handle_event:
* Called from widget event handling code on Drag events
......@@ -1042,25 +1091,35 @@ gtk_drag_dest_handle_event (GtkWidget *toplevel,
}
}
/*************************************************************
/**
* gtk_drag_dest_find_target:
* Decide on a target for the drag.
* arguments:
* site:
* context:
* results:
*************************************************************/
static GdkAtom
gtk_drag_dest_find_target (GtkWidget *widget,
GtkDragDestSite *site,
GdkDragContext *context)
* @widget: drag destination widget
* @context: drag context
* @dest_target_list: list of droppable targets
*
* Looks for a match between @context->targets and the
* @dest_target_list, returning the first matching target, otherwise
* returning %GDK_NONE. @dest_target_list should usually be the return
* value from gtk_drag_dest_get_target_list(), but some widgets may
* have different valid targets for different parts of the widget; in
* that case, they will have to implement a drag_motion handler that
* passes the correct target list to this function.
*
* Return value: first target that the source offers and the dest can accept, or %GDK_NONE
**/
GdkAtom
gtk_drag_dest_find_target (GtkWidget *widget,
GdkDragContext *context,
GtkTargetList *dest_target_list)
{
GList *tmp_target;
GList *tmp_source = NULL;
GtkWidget *source_widget = gtk_drag_get_source_widget (context);
tmp_target = site->target_list->list;
if (dest_target_list == NULL)
return GDK_NONE;
tmp_target = dest_target_list->list;
while (tmp_target)
{
GtkTargetPair *pair = tmp_target->data;
......@@ -1532,7 +1591,7 @@ gtk_drag_dest_motion (GtkWidget *widget,
}
}
if (action && gtk_drag_dest_find_target (widget, site, context))
if (action && gtk_drag_dest_find_target (widget, context, site->target_list))
{
if (!site->have_drag)
{
......@@ -1639,7 +1698,7 @@ gtk_drag_dest_drop (GtkWidget *widget,
if (site->flags & GTK_DEST_DEFAULT_DROP)
{
GdkAtom target = gtk_drag_dest_find_target (widget, site, context);
GdkAtom target = gtk_drag_dest_find_target (widget, context, site->target_list);
if (target == GDK_NONE)
return FALSE;
......@@ -2453,6 +2512,7 @@ gtk_drag_source_event_cb (GtkWidget *widget,
i, event);
info = gtk_drag_get_source_info (context, FALSE);
if (!info->icon_window)
{
if (site->pixmap)
......
......@@ -77,12 +77,15 @@ void gtk_drag_dest_set_proxy (GtkWidget *widget,
GdkDragProtocol protocol,
gboolean use_coordinates);
/* There probably should be functions for setting the targets
* as a GtkTargetList
*/
void gtk_drag_dest_unset (GtkWidget *widget);
GdkAtom gtk_drag_dest_find_target (GtkWidget *widget,
GdkDragContext *context,
GtkTargetList *target_list);
GtkTargetList* gtk_drag_dest_get_target_list (GtkWidget *widget);
void gtk_drag_dest_set_target_list (GtkWidget *widget,
GtkTargetList *target_list);
/* Source side */
void gtk_drag_source_set (GtkWidget *widget,
......
......@@ -647,14 +647,19 @@ _gtk_rbtree_node_find_offset (GtkRBTree *tree,
{
last = node;
node = node->parent;
/* Add left branch, plus children, iff we came from the right */
if (node->right == last)
retval += node->left->offset + GTK_RBNODE_GET_HEIGHT (node);
retval += node->offset - node->right->offset;
if (node == tree->nil)
{
node = tree->parent_node;
tree = tree->parent_tree;
/* Add the parent node, plus the left branch. */
if (node)
retval += node->left->offset;
retval += node->left->offset + GTK_RBNODE_GET_HEIGHT (node);
}
}
return retval;
......
......@@ -57,14 +57,17 @@ struct _GtkRBNode
GtkRBNode *left;
GtkRBNode *right;
GtkRBNode *parent;
gint count; /* aggregate number of children we have */
gint offset; /* aggregate of the heights of all our children */
GtkRBTree *children;
};
struct _GtkRBNodeView
{
GtkRBNode parent;
/* count is the number of nodes beneath us, plus 1 for ourselves.
* i.e. node->left->count + node->right->count + 1
*/
gint count;
/* this is the total of sizes of
* node->left, node->right, our own height, and the height
* of all trees in ->children, iff children exists because
* the thing is expanded.
*/
gint offset;
GtkRBTree *children;
};
......
......@@ -4235,19 +4235,13 @@ gtk_text_view_start_selection_dnd (GtkTextView *text_view,
gtk_target_list_unref (target_list);
gtk_drag_set_icon_default (context);
/* We're inside the selection, so start without being able
* to accept the drag.
*/
gdk_drag_status (context, 0, event->time);
gtk_text_mark_set_visible (text_view->dnd_mark, FALSE);
}
static void
gtk_text_view_drag_begin (GtkWidget *widget,
GdkDragContext *context)
{
/* do nothing */
}
static void
......@@ -4257,14 +4251,6 @@ gtk_text_view_drag_end (GtkWidget *widget,
GtkTextView *text_view;
text_view = GTK_TEXT_VIEW (widget);
gtk_text_mark_set_visible (text_view->dnd_mark, FALSE);
if (text_view->scroll_timeout != 0)
{
gtk_timeout_remove (text_view->scroll_timeout);
text_view->scroll_timeout = 0;
}
}
static void
......@@ -4353,6 +4339,7 @@ gtk_text_view_drag_motion (GtkWidget *widget,
GtkTextIter end;
GdkRectangle target_rect;
gint bx, by;
GdkDragAction suggested_action = 0;
text_view = GTK_TEXT_VIEW (widget);
......@@ -4362,7 +4349,7 @@ gtk_text_view_drag_motion (GtkWidget *widget,
y < target_rect.y ||
x > (target_rect.x + target_rect.width) ||
y > (target_rect.y + target_rect.height))
return FALSE; /* outside the text window */
return FALSE; /* outside the text window, allow parent widgets to handle event */
gtk_text_view_window_to_buffer_coords (text_view,
GTK_TEXT_WINDOW_WIDGET,
......@@ -4372,21 +4359,23 @@ gtk_text_view_drag_motion (GtkWidget *widget,
gtk_text_layout_get_iter_at_pixel (text_view->layout,
&newplace,
bx, by);
if (gtk_text_buffer_get_selection_bounds (get_buffer (text_view),
if (gtk_drag_dest_find_target (widget, context,
gtk_drag_dest_get_target_list (widget)) == GDK_NONE)
{
/* can't accept any of the offered targets */
}
else if (gtk_text_buffer_get_selection_bounds (get_buffer (text_view),
&start, &end) &&
gtk_text_iter_in_range (&newplace, &start, &end))
{
/* We're inside the selection. */
gdk_drag_status (context, 0, time);
gtk_text_mark_set_visible (text_view->dnd_mark, FALSE);
}
else
{
if (gtk_text_iter_editable (&newplace, text_view->editable))
{
GtkWidget *source_widget;
GdkDragAction suggested_action;
suggested_action = context->suggested_action;
......@@ -4400,20 +4389,26 @@ gtk_text_view_drag_motion (GtkWidget *widget,
if ((context->actions & GDK_ACTION_MOVE) != 0)
suggested_action = GDK_ACTION_MOVE;
}
gtk_text_mark_set_visible (text_view->dnd_mark,
text_view->cursor_visible);
gdk_drag_status (context, suggested_action, time);
}
else
{
/* Can't drop here. */
gdk_drag_status (context, 0, time);
gtk_text_mark_set_visible (text_view->dnd_mark, FALSE);
}
}
if (suggested_action != 0)
{
gtk_text_mark_set_visible (text_view->dnd_mark,
text_view->cursor_visible);
gdk_drag_status (context, suggested_action, time);
}
else
{
gdk_drag_status (context, 0, time);
gtk_text_mark_set_visible (text_view->dnd_mark, FALSE);
}
gtk_text_buffer_move_mark (get_buffer (text_view),
text_view->dnd_mark,
&newplace);
......@@ -4427,7 +4422,10 @@ gtk_text_view_drag_motion (GtkWidget *widget,
text_view->scroll_timeout =
gtk_timeout_add (50, drag_scan_timeout, text_view);
/* TRUE return means don't propagate the drag motion to parent
* widgets that may also be drop sites.
*/
return TRUE;
}
......@@ -4438,18 +4436,17 @@ gtk_text_view_drag_drop (GtkWidget *widget,
gint y,
guint time)
{
#if 0