Fix for win32 GtkTreeView DnD bug



Two bugs are fixed by the attached diff file:

1) In gdk_drag_find_window_for_screen the call to WindowFromPoint would
consistantly return the handle to the DnD pointer icon window (created
by gtk_drag_set_icon_pixmap), instead of the DnD target window
underneath. The solution (not a good one) is to offset the pointer icon
window 1 pixel from the pointer position (in the call to
gtk_drag_set_icon_pixmap), so that the pointer position won't be within
the bounds of the DnD pointer icon window when the call to
WindowFromPoint is made.

2) After fixing the first bug, I noticed that rows were being copied
instead of moved.. In other words the row delete part of the DnD move
was failing.  gdk_drag_status was not setting the context action.

Still not working:
When both GDK_ACTION_MOVE and GDK_ACTION_COPY DnD operations are
permitted, holding down the ctrl key will not enable the copy action.

- Herman

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
diff -r -u gtk+-2.2.2.orig/gdk/win32/gdkdnd-win32.c gtk+-2.2.2/gdk/win32/gdkdnd-win32.c
--- gtk+-2.2.2.orig/gdk/win32/gdkdnd-win32.c	2002-11-12 17:17:37.000000000 -0500
+++ gtk+-2.2.2/gdk/win32/gdkdnd-win32.c	2003-06-27 22:04:35.000000000 -0400
@@ -1507,6 +1507,8 @@
 
   private = GDK_DRAG_CONTEXT_PRIVATE_DATA (context);
 
+  context->action = action;
+
   src_context = gdk_drag_context_find (TRUE,
 				       context->source_window,
 				       context->dest_window);

diff -r -u gtk+-2.2.2.orig/gtk/gtktreeview.c gtk+-2.2.2/gtk/gtktreeview.c
--- gtk+-2.2.2.orig/gtk/gtktreeview.c	2003-06-06 17:41:18.000000000 -0400
+++ gtk+-2.2.2/gtk/gtktreeview.c	2003-06-27 22:42:28.000000000 -0400
@@ -5076,9 +5076,16 @@
                             gdk_drawable_get_colormap (row_pix),
                             row_pix,
                             NULL,
+#if 0
                             /* the + 1 is for the black border in the icon */
                             tree_view->priv->press_start_x + 1,
-                            cell_y + 1);
+                            cell_y + 1
+#else
+			    /* Fix for Windows */
+			    -1,
+			    -1
+#endif
+			    );
 
   g_object_unref (row_pix);
   gtk_tree_path_free (path);


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