--- gtknotebook.c.orig	2008-09-05 03:31:44.000000000 +0200
+++ gtknotebook.c	2008-10-03 17:21:09.000000000 +0200
@@ -2408,6 +2408,7 @@
       *x = tx;
       *y = ty;
 
+printf("get_widget_coordinates() tx=%f, ty=%f\n", tx, ty);
       return TRUE;
     }
   else
@@ -2490,6 +2491,8 @@
   if (!get_widget_coordinates (widget, (GdkEvent *)event, &x, &y))
     return FALSE;
 
+printf("gtk_notebook_button_press() x=%d, y=%d\n", x, y);
+
   arrow = gtk_notebook_get_arrow (notebook, x, y);
   if (arrow)
     return gtk_notebook_arrow_button_press (notebook, arrow, event->button);
@@ -2841,6 +2844,7 @@
   if (!get_widget_coordinates (widget, (GdkEvent *)event, &x, &y))
     return FALSE;
 
+printf("gtk_notebook_leave_notify() x=%d, y=%d\n", x, y);
   if (notebook->in_child)
     {
       notebook->in_child = 0;
@@ -2938,6 +2942,7 @@
 
   /* we want a large threshold */
   dnd_threshold *= DND_THRESHOLD_MULTIPLIER;
+printf("check_threshold(): dnd_threshold=%d\n", dnd_threshold);
 
   gdk_window_get_position (notebook->event_window, &rectangle.x, &rectangle.y);
   gdk_drawable_get_size (GDK_DRAWABLE (notebook->event_window), &rectangle.width, &rectangle.height);
@@ -2947,6 +2952,8 @@
   rectangle.y -= dnd_threshold;
   rectangle.height += 2 * dnd_threshold;
 
+printf("check_threshold(): current_x=%d rectangle.x=%d, rectangle.width=%d\n", current_x, rectangle.x, rectangle.width);
+printf("check_threshold(): current_y=%d, rectangle.y=%d, rectangle.height=%d\n", current_y, rectangle.y, rectangle.height);
   return (current_x < rectangle.x ||
 	  current_x > rectangle.x + rectangle.width ||
 	  current_y < rectangle.y ||
@@ -2964,6 +2971,7 @@
   GtkNotebookPointerPosition pointer_position;
   GtkSettings *settings;
   guint timeout;
+  gint x, y;
 
   page = notebook->cur_page;
 
@@ -2982,10 +2990,14 @@
 
   priv->timestamp = event->time;
   gdk_window_get_pointer (widget->window,
-			  &priv->mouse_x,
-			  &priv->mouse_y,
+			  &x,
+			  &y,
 			  NULL);
 
+  priv->mouse_x=event->x;
+  priv->mouse_y=event->y;
+  printf("gtk_notebook_motion_notify() event=(%d, %d), get_pointer=(%d, %d)\n", (gint)(event->x), (gint)(event->y), x, y);
+
   arrow = gtk_notebook_get_arrow (notebook, priv->mouse_x, priv->mouse_y);
   if (arrow != notebook->in_child)
     {
@@ -2999,6 +3011,7 @@
   if (page->detachable &&
       check_threshold (notebook, priv->mouse_x, priv->mouse_y))
     {
+printf("reached threshold\n");
       priv->detached_tab = notebook->cur_page;
       priv->during_detach = TRUE;
 
@@ -3204,6 +3217,7 @@
     }
 
   priv->operation = DRAG_OPERATION_DETACH;
+printf("gtk_notebook_drag_begin()\n");
   gtk_notebook_pages_allocate (notebook);
 
   tab_label = priv->detached_tab->tab_label;
