]> Pileus Git - ~andy/gtk/commitdiff
Fix coordinate translations, once and for all.
authorOwen Taylor <otaylor@redhat.com>
Tue, 8 Jan 2002 21:17:55 +0000 (21:17 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Tue, 8 Jan 2002 21:17:55 +0000 (21:17 +0000)
Tue Jan  8 15:53:28 2002  Owen Taylor  <otaylor@redhat.com>

* gtk/gtkdnd.c (gtk_drag_find_widget): Fix coordinate
translations, once and for all.

* gtk/gtktextbuffer.c (paste_from_buffer): Free
the ClipboardRequest structure. (#66198, HideToshi
Tajima)

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkdnd.c
gtk/gtktextbuffer.c

index 26490977c5ed31cf7c3d0fd02dd8bf0447ef1547..8ffd41af97b54136215ab27648f2e091bbe591f0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Tue Jan  8 15:53:28 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkdnd.c (gtk_drag_find_widget): Fix coordinate
+       translations, once and for all.
+
+       * gtk/gtktextbuffer.c (paste_from_buffer): Free
+       the ClipboardRequest structure. (#66198, HideToshi
+       Tajima)
+
 2002-01-08  jacob berkman  <jacob@ximian.com>
 
        * gtk/gtklayout.c (gtk_layout_move_internal): queue a resize on
@@ -7,6 +16,7 @@ Tue Jan  8 14:51:19 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkpaned.c (gtk_paned_expose): Don't draw
        the handle if we aren't showing both children.
+       (#68135, Diego Gonzalez)
 
 Tue Jan  8 14:45:43 2002  Owen Taylor  <otaylor@redhat.com>
 
index 26490977c5ed31cf7c3d0fd02dd8bf0447ef1547..8ffd41af97b54136215ab27648f2e091bbe591f0 100644 (file)
@@ -1,3 +1,12 @@
+Tue Jan  8 15:53:28 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkdnd.c (gtk_drag_find_widget): Fix coordinate
+       translations, once and for all.
+
+       * gtk/gtktextbuffer.c (paste_from_buffer): Free
+       the ClipboardRequest structure. (#66198, HideToshi
+       Tajima)
+
 2002-01-08  jacob berkman  <jacob@ximian.com>
 
        * gtk/gtklayout.c (gtk_layout_move_internal): queue a resize on
@@ -7,6 +16,7 @@ Tue Jan  8 14:51:19 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkpaned.c (gtk_paned_expose): Don't draw
        the handle if we aren't showing both children.
+       (#68135, Diego Gonzalez)
 
 Tue Jan  8 14:45:43 2002  Owen Taylor  <otaylor@redhat.com>
 
index 26490977c5ed31cf7c3d0fd02dd8bf0447ef1547..8ffd41af97b54136215ab27648f2e091bbe591f0 100644 (file)
@@ -1,3 +1,12 @@
+Tue Jan  8 15:53:28 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkdnd.c (gtk_drag_find_widget): Fix coordinate
+       translations, once and for all.
+
+       * gtk/gtktextbuffer.c (paste_from_buffer): Free
+       the ClipboardRequest structure. (#66198, HideToshi
+       Tajima)
+
 2002-01-08  jacob berkman  <jacob@ximian.com>
 
        * gtk/gtklayout.c (gtk_layout_move_internal): queue a resize on
@@ -7,6 +16,7 @@ Tue Jan  8 14:51:19 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkpaned.c (gtk_paned_expose): Don't draw
        the handle if we aren't showing both children.
+       (#68135, Diego Gonzalez)
 
 Tue Jan  8 14:45:43 2002  Owen Taylor  <otaylor@redhat.com>
 
index 26490977c5ed31cf7c3d0fd02dd8bf0447ef1547..8ffd41af97b54136215ab27648f2e091bbe591f0 100644 (file)
@@ -1,3 +1,12 @@
+Tue Jan  8 15:53:28 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkdnd.c (gtk_drag_find_widget): Fix coordinate
+       translations, once and for all.
+
+       * gtk/gtktextbuffer.c (paste_from_buffer): Free
+       the ClipboardRequest structure. (#66198, HideToshi
+       Tajima)
+
 2002-01-08  jacob berkman  <jacob@ximian.com>
 
        * gtk/gtklayout.c (gtk_layout_move_internal): queue a resize on
@@ -7,6 +16,7 @@ Tue Jan  8 14:51:19 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkpaned.c (gtk_paned_expose): Don't draw
        the handle if we aren't showing both children.
+       (#68135, Diego Gonzalez)
 
 Tue Jan  8 14:45:43 2002  Owen Taylor  <otaylor@redhat.com>
 
index 26490977c5ed31cf7c3d0fd02dd8bf0447ef1547..8ffd41af97b54136215ab27648f2e091bbe591f0 100644 (file)
@@ -1,3 +1,12 @@
+Tue Jan  8 15:53:28 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkdnd.c (gtk_drag_find_widget): Fix coordinate
+       translations, once and for all.
+
+       * gtk/gtktextbuffer.c (paste_from_buffer): Free
+       the ClipboardRequest structure. (#66198, HideToshi
+       Tajima)
+
 2002-01-08  jacob berkman  <jacob@ximian.com>
 
        * gtk/gtklayout.c (gtk_layout_move_internal): queue a resize on
@@ -7,6 +16,7 @@ Tue Jan  8 14:51:19 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkpaned.c (gtk_paned_expose): Don't draw
        the handle if we aren't showing both children.
+       (#68135, Diego Gonzalez)
 
 Tue Jan  8 14:45:43 2002  Owen Taylor  <otaylor@redhat.com>
 
index 26490977c5ed31cf7c3d0fd02dd8bf0447ef1547..8ffd41af97b54136215ab27648f2e091bbe591f0 100644 (file)
@@ -1,3 +1,12 @@
+Tue Jan  8 15:53:28 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkdnd.c (gtk_drag_find_widget): Fix coordinate
+       translations, once and for all.
+
+       * gtk/gtktextbuffer.c (paste_from_buffer): Free
+       the ClipboardRequest structure. (#66198, HideToshi
+       Tajima)
+
 2002-01-08  jacob berkman  <jacob@ximian.com>
 
        * gtk/gtklayout.c (gtk_layout_move_internal): queue a resize on
@@ -7,6 +16,7 @@ Tue Jan  8 14:51:19 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkpaned.c (gtk_paned_expose): Don't draw
        the handle if we aren't showing both children.
+       (#68135, Diego Gonzalez)
 
 Tue Jan  8 14:45:43 2002  Owen Taylor  <otaylor@redhat.com>
 
index 26490977c5ed31cf7c3d0fd02dd8bf0447ef1547..8ffd41af97b54136215ab27648f2e091bbe591f0 100644 (file)
@@ -1,3 +1,12 @@
+Tue Jan  8 15:53:28 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkdnd.c (gtk_drag_find_widget): Fix coordinate
+       translations, once and for all.
+
+       * gtk/gtktextbuffer.c (paste_from_buffer): Free
+       the ClipboardRequest structure. (#66198, HideToshi
+       Tajima)
+
 2002-01-08  jacob berkman  <jacob@ximian.com>
 
        * gtk/gtklayout.c (gtk_layout_move_internal): queue a resize on
@@ -7,6 +16,7 @@ Tue Jan  8 14:51:19 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkpaned.c (gtk_paned_expose): Don't draw
        the handle if we aren't showing both children.
+       (#68135, Diego Gonzalez)
 
 Tue Jan  8 14:45:43 2002  Owen Taylor  <otaylor@redhat.com>
 
index 9611bbe0f9b5f355f67d1054af530935ff1bb2f4..ca209fade073cd3541c9a3a9e6322f8634a8f4c8 100644 (file)
@@ -1229,6 +1229,8 @@ gtk_drag_find_widget (GtkWidget       *widget,
                      GtkDragFindData *data)
 {
   GtkAllocation new_allocation;
+  gint allocation_to_window_x = 0;
+  gint allocation_to_window_y = 0;
   gint x_offset = 0;
   gint y_offset = 0;
 
@@ -1253,38 +1255,36 @@ gtk_drag_find_widget (GtkWidget       *widget,
 
   if (widget->parent)
     {
-      gint tx, ty, twidth, theight;
+      gint tx, ty;
       GdkWindow *window = widget->window;
 
-      /* Correct for the fact that the allocation is relative
-       * to the parent window for window widgets, not to widget->window.
+      /* Compute the offset from allocation-relative to
+       * window-relative coordinates.
        */
+      allocation_to_window_x = widget->allocation.x;
+      allocation_to_window_y = widget->allocation.y;
+
       if (!GTK_WIDGET_NO_WINDOW (widget))
        {
+         /* The allocation is relative to the parent window for
+          * window widgets, not to widget->window.
+          */
           gdk_window_get_position (window, &tx, &ty);
          
-          new_allocation.x -= tx;
-         new_allocation.y -= ty;
+          allocation_to_window_x -= tx;
+          allocation_to_window_y -= ty;
        }
 
+      new_allocation.x = 0 + allocation_to_window_x;
+      new_allocation.y = 0 + allocation_to_window_y;
+      
       while (window && window != widget->parent->window)
-       {       
-         gdk_window_get_size (window, &twidth, &theight);
+       {
+         GdkRectangle window_rect = { 0, 0, 0, 0 };
+         
+         gdk_window_get_size (window, &window_rect.width, &window_rect.height);
 
-         if (new_allocation.x < 0)
-           {
-             new_allocation.width += new_allocation.x;
-             new_allocation.x = 0;
-           }
-         if (new_allocation.y < 0)
-           {
-             new_allocation.height += new_allocation.y;
-             new_allocation.y = 0;
-           }
-         if (new_allocation.x + new_allocation.width > twidth)
-           new_allocation.width = twidth - new_allocation.x;
-         if (new_allocation.y + new_allocation.height > theight)
-           new_allocation.height = theight - new_allocation.y;
+         gdk_rectangle_intersect (&new_allocation, &window_rect, &new_allocation);
 
          gdk_window_get_position (window, &tx, &ty);
          new_allocation.x += tx;
@@ -1342,8 +1342,8 @@ gtk_drag_find_widget (GtkWidget       *widget,
        {
          data->found = data->callback (widget,
                                        data->context,
-                                       data->x - new_allocation.x - x_offset,
-                                       data->y - new_allocation.y - y_offset,
+                                       data->x - x_offset - allocation_to_window_x,
+                                       data->y - y_offset - allocation_to_window_y,
                                        data->time);
          /* If so, send a "drag_leave" to the last widget */
          if (data->found)
index 250dde4e6a9581d423b8595b92d1ef736348ebed..7650d41e2ac29a9634c0968924edad7f58bd1147 100644 (file)
@@ -2897,6 +2897,7 @@ paste_from_buffer (ClipboardRequest    *request_data,
   post_paste_cleanup (request_data);
       
   g_object_unref (G_OBJECT (src_buffer));
+  g_free (request_data);
 }
 
 static void