comparison pidgin/gtkblist.c @ 17487:4b711c5c2db8

Only auto-expand buddies when the mouse is hovering over the middle third of the buddy. This prevents un-intended expanding of buddies when you're only trying to re-order. Fixes #608
author Sean Egan <seanegan@gmail.com>
date Thu, 31 May 2007 00:47:24 +0000
parents fae50c8130d3
children 45178b7e580d
comparison
equal deleted inserted replaced
17486:ec8a4b674d50 17487:4b711c5c2db8
2719 static gboolean pidgin_blist_drag_motion_cb(GtkWidget *tv, GdkDragContext *drag_context, 2719 static gboolean pidgin_blist_drag_motion_cb(GtkWidget *tv, GdkDragContext *drag_context,
2720 gint x, gint y, guint time, gpointer user_data) 2720 gint x, gint y, guint time, gpointer user_data)
2721 { 2721 {
2722 GtkTreePath *path; 2722 GtkTreePath *path;
2723 int delay; 2723 int delay;
2724 GdkRectangle rect;
2724 2725
2725 /* 2726 /*
2726 * When dragging a buddy into a contact, this is the delay before 2727 * When dragging a buddy into a contact, this is the delay before
2727 * the contact auto-expands. 2728 * the contact auto-expands.
2728 */ 2729 */
2734 /* We've left the cell. Remove the timeout and create a new one below */ 2735 /* We've left the cell. Remove the timeout and create a new one below */
2735 g_source_remove(gtkblist->drag_timeout); 2736 g_source_remove(gtkblist->drag_timeout);
2736 } 2737 }
2737 2738
2738 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), x, y, &path, NULL, NULL, NULL); 2739 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), x, y, &path, NULL, NULL, NULL);
2739 gtk_tree_view_get_cell_area(GTK_TREE_VIEW(tv), path, NULL, &gtkblist->tip_rect); 2740 gtk_tree_view_get_cell_area(GTK_TREE_VIEW(tv), path, NULL, &rect);
2741
2742 /* Only autoexpand when in the middle of the cell to avoid annoying un-intended expands */
2743 if (y < rect.y + (rect.height / 3) ||
2744 y > rect.y + (2 * (rect.height /3)))
2745 return FALSE;
2746
2747 rect.height = rect.height / 3;
2748 rect.y += rect.height;
2749
2750 gtkblist->tip_rect = rect;
2740 2751
2741 if (path) 2752 if (path)
2742 gtk_tree_path_free(path); 2753 gtk_tree_path_free(path);
2743 gtkblist->drag_timeout = g_timeout_add(delay, (GSourceFunc)pidgin_blist_expand_timeout, tv); 2754 gtkblist->drag_timeout = g_timeout_add(delay, (GSourceFunc)pidgin_blist_expand_timeout, tv);
2744 2755