Commit cc605cf5 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Fix coordinate translations, once and for all.

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)
parent c4591330
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>
......
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>
......
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>
......
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>
......
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>
......
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>
......
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>
......
......@@ -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)
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment