Adjust saved positions of children when resizing a guffaw_gravity = TRUE

Fri Feb  5 13:23:50 1999  Owen Taylor  <otaylor@redhat.com>

	* gdk/gdkwindow.c (gdk_window_move_resize): Adjust
	saved positions of children when resizing a
	guffaw_gravity = TRUE window.

	* gtk/gtkdnd.c (gtk_drag_highlight): Rework the
	 highlighting so that it is done in callbacks for
	 draw and expose. This should solve problems with
         multiple highlights for the same GdkWindow.

	* gtk/gtkdnd.c (gtk_drag_highlight): Fix bug where
	the highlight was being drawn with an incorrect
	width/height for !NO_WINDOW widgets.
This commit is contained in:
Owen Taylor 1999-02-05 18:40:14 +00:00 committed by Owen Taylor
parent 915f2c5e59
commit eb437560d3
10 changed files with 264 additions and 86 deletions

View File

@ -1,3 +1,24 @@
Fri Feb 5 13:23:50 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c (gdk_window_move_resize): Adjust
saved positions of children when resizing a
guffaw_gravity = TRUE window.
* gtk/gtkdnd.c (gtk_drag_highlight): Rework the
highlighting so that it is done in callbacks for
draw and expose. This should solve problems with
multiple highlights for the same GdkWindow.
* gtk/gtkdnd.c (gtk_drag_highlight): Fix bug where
the highlight was being drawn with an incorrect
width/height for !NO_WINDOW widgets.
Tue Feb 2 11:06:02 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c (gtk_range_style_set): Fixes
to account for the changed structure of the windows
of range widgets.
1999-02-05 Owen Taylor <otaylor@gtk.org>
* gtk/gtk[hv]paned.c (gtk_[hv]paned_size_allocate):
@ -35,12 +56,6 @@ Tue Feb 2 12:39:42 1999 Owen Taylor <otaylor@redhat.com>
Make it consistent that info->cur_x/y do not include
info->hot_x/y displacement.
Tue Feb 2 11:06:02 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c (gtk_range_style_set): Fixes
to account for the changed structure of the windows
of range widgets.
Tue Feb 2 08:59:16 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml: new sections on Layout and

View File

@ -1,3 +1,24 @@
Fri Feb 5 13:23:50 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c (gdk_window_move_resize): Adjust
saved positions of children when resizing a
guffaw_gravity = TRUE window.
* gtk/gtkdnd.c (gtk_drag_highlight): Rework the
highlighting so that it is done in callbacks for
draw and expose. This should solve problems with
multiple highlights for the same GdkWindow.
* gtk/gtkdnd.c (gtk_drag_highlight): Fix bug where
the highlight was being drawn with an incorrect
width/height for !NO_WINDOW widgets.
Tue Feb 2 11:06:02 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c (gtk_range_style_set): Fixes
to account for the changed structure of the windows
of range widgets.
1999-02-05 Owen Taylor <otaylor@gtk.org>
* gtk/gtk[hv]paned.c (gtk_[hv]paned_size_allocate):
@ -35,12 +56,6 @@ Tue Feb 2 12:39:42 1999 Owen Taylor <otaylor@redhat.com>
Make it consistent that info->cur_x/y do not include
info->hot_x/y displacement.
Tue Feb 2 11:06:02 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c (gtk_range_style_set): Fixes
to account for the changed structure of the windows
of range widgets.
Tue Feb 2 08:59:16 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml: new sections on Layout and

View File

@ -1,3 +1,24 @@
Fri Feb 5 13:23:50 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c (gdk_window_move_resize): Adjust
saved positions of children when resizing a
guffaw_gravity = TRUE window.
* gtk/gtkdnd.c (gtk_drag_highlight): Rework the
highlighting so that it is done in callbacks for
draw and expose. This should solve problems with
multiple highlights for the same GdkWindow.
* gtk/gtkdnd.c (gtk_drag_highlight): Fix bug where
the highlight was being drawn with an incorrect
width/height for !NO_WINDOW widgets.
Tue Feb 2 11:06:02 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c (gtk_range_style_set): Fixes
to account for the changed structure of the windows
of range widgets.
1999-02-05 Owen Taylor <otaylor@gtk.org>
* gtk/gtk[hv]paned.c (gtk_[hv]paned_size_allocate):
@ -35,12 +56,6 @@ Tue Feb 2 12:39:42 1999 Owen Taylor <otaylor@redhat.com>
Make it consistent that info->cur_x/y do not include
info->hot_x/y displacement.
Tue Feb 2 11:06:02 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c (gtk_range_style_set): Fixes
to account for the changed structure of the windows
of range widgets.
Tue Feb 2 08:59:16 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml: new sections on Layout and

View File

@ -1,3 +1,24 @@
Fri Feb 5 13:23:50 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c (gdk_window_move_resize): Adjust
saved positions of children when resizing a
guffaw_gravity = TRUE window.
* gtk/gtkdnd.c (gtk_drag_highlight): Rework the
highlighting so that it is done in callbacks for
draw and expose. This should solve problems with
multiple highlights for the same GdkWindow.
* gtk/gtkdnd.c (gtk_drag_highlight): Fix bug where
the highlight was being drawn with an incorrect
width/height for !NO_WINDOW widgets.
Tue Feb 2 11:06:02 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c (gtk_range_style_set): Fixes
to account for the changed structure of the windows
of range widgets.
1999-02-05 Owen Taylor <otaylor@gtk.org>
* gtk/gtk[hv]paned.c (gtk_[hv]paned_size_allocate):
@ -35,12 +56,6 @@ Tue Feb 2 12:39:42 1999 Owen Taylor <otaylor@redhat.com>
Make it consistent that info->cur_x/y do not include
info->hot_x/y displacement.
Tue Feb 2 11:06:02 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c (gtk_range_style_set): Fixes
to account for the changed structure of the windows
of range widgets.
Tue Feb 2 08:59:16 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml: new sections on Layout and

View File

@ -1,3 +1,24 @@
Fri Feb 5 13:23:50 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c (gdk_window_move_resize): Adjust
saved positions of children when resizing a
guffaw_gravity = TRUE window.
* gtk/gtkdnd.c (gtk_drag_highlight): Rework the
highlighting so that it is done in callbacks for
draw and expose. This should solve problems with
multiple highlights for the same GdkWindow.
* gtk/gtkdnd.c (gtk_drag_highlight): Fix bug where
the highlight was being drawn with an incorrect
width/height for !NO_WINDOW widgets.
Tue Feb 2 11:06:02 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c (gtk_range_style_set): Fixes
to account for the changed structure of the windows
of range widgets.
1999-02-05 Owen Taylor <otaylor@gtk.org>
* gtk/gtk[hv]paned.c (gtk_[hv]paned_size_allocate):
@ -35,12 +56,6 @@ Tue Feb 2 12:39:42 1999 Owen Taylor <otaylor@redhat.com>
Make it consistent that info->cur_x/y do not include
info->hot_x/y displacement.
Tue Feb 2 11:06:02 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c (gtk_range_style_set): Fixes
to account for the changed structure of the windows
of range widgets.
Tue Feb 2 08:59:16 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml: new sections on Layout and

View File

@ -1,3 +1,24 @@
Fri Feb 5 13:23:50 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c (gdk_window_move_resize): Adjust
saved positions of children when resizing a
guffaw_gravity = TRUE window.
* gtk/gtkdnd.c (gtk_drag_highlight): Rework the
highlighting so that it is done in callbacks for
draw and expose. This should solve problems with
multiple highlights for the same GdkWindow.
* gtk/gtkdnd.c (gtk_drag_highlight): Fix bug where
the highlight was being drawn with an incorrect
width/height for !NO_WINDOW widgets.
Tue Feb 2 11:06:02 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c (gtk_range_style_set): Fixes
to account for the changed structure of the windows
of range widgets.
1999-02-05 Owen Taylor <otaylor@gtk.org>
* gtk/gtk[hv]paned.c (gtk_[hv]paned_size_allocate):
@ -35,12 +56,6 @@ Tue Feb 2 12:39:42 1999 Owen Taylor <otaylor@redhat.com>
Make it consistent that info->cur_x/y do not include
info->hot_x/y displacement.
Tue Feb 2 11:06:02 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c (gtk_range_style_set): Fixes
to account for the changed structure of the windows
of range widgets.
Tue Feb 2 08:59:16 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml: new sections on Layout and

View File

@ -1,3 +1,24 @@
Fri Feb 5 13:23:50 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c (gdk_window_move_resize): Adjust
saved positions of children when resizing a
guffaw_gravity = TRUE window.
* gtk/gtkdnd.c (gtk_drag_highlight): Rework the
highlighting so that it is done in callbacks for
draw and expose. This should solve problems with
multiple highlights for the same GdkWindow.
* gtk/gtkdnd.c (gtk_drag_highlight): Fix bug where
the highlight was being drawn with an incorrect
width/height for !NO_WINDOW widgets.
Tue Feb 2 11:06:02 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c (gtk_range_style_set): Fixes
to account for the changed structure of the windows
of range widgets.
1999-02-05 Owen Taylor <otaylor@gtk.org>
* gtk/gtk[hv]paned.c (gtk_[hv]paned_size_allocate):
@ -35,12 +56,6 @@ Tue Feb 2 12:39:42 1999 Owen Taylor <otaylor@redhat.com>
Make it consistent that info->cur_x/y do not include
info->hot_x/y displacement.
Tue Feb 2 11:06:02 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c (gtk_range_style_set): Fixes
to account for the changed structure of the windows
of range widgets.
Tue Feb 2 08:59:16 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml: new sections on Layout and

View File

@ -852,6 +852,20 @@ gdk_window_move_resize (GdkWindow *window,
{
XMoveResizeWindow (private->xdisplay, private->xwindow, x, y, width, height);
if (private->guffaw_gravity)
{
GList *tmp_list = private->children;
while (tmp_list)
{
GdkWindowPrivate *child_private = tmp_list->data;
child_private->x -= x - private->x;
child_private->y -= y - private->y;
tmp_list = tmp_list->next;
}
}
if (private->window_type == GDK_WINDOW_CHILD)
{
private->x = x;

View File

@ -852,6 +852,20 @@ gdk_window_move_resize (GdkWindow *window,
{
XMoveResizeWindow (private->xdisplay, private->xwindow, x, y, width, height);
if (private->guffaw_gravity)
{
GList *tmp_list = private->children;
while (tmp_list)
{
GdkWindowPrivate *child_private = tmp_list->data;
child_private->x -= x - private->x;
child_private->y -= y - private->y;
tmp_list = tmp_list->next;
}
}
if (private->window_type == GDK_WINDOW_CHILD)
{
private->x = x;

View File

@ -155,6 +155,12 @@ static GdkCursor * gtk_drag_get_cursor (GdkDragAction action);
static GtkWidget *gtk_drag_get_ipc_widget (void);
static void gtk_drag_release_ipc_widget (GtkWidget *widget);
static void gtk_drag_highlight_paint (GtkWidget *widget);
static gboolean gtk_drag_highlight_expose (GtkWidget *widget,
GdkEventExpose *event,
gpointer data);
static GdkAtom gtk_drag_dest_find_target (GtkWidget *widget,
GtkDragDestSite *site,
GdkDragContext *context);
@ -649,6 +655,67 @@ gtk_drag_finish (GdkDragContext *context,
gdk_drop_finish (context, success, time);
}
/*************************************************************
* gtk_drag_highlight_paint:
* Paint a highlight indicating drag status onto the widget.
* arguments:
* widget:
* results:
*************************************************************/
static void
gtk_drag_highlight_paint (GtkWidget *widget)
{
gint x, y, width, height;
g_return_if_fail (widget != NULL);
if (GTK_WIDGET_DRAWABLE (widget))
{
if (GTK_WIDGET_NO_WINDOW (widget))
{
x = widget->allocation.x;
y = widget->allocation.y;
width = widget->allocation.width;
height = widget->allocation.height;
}
else
{
x = 0;
y = 0;
gdk_window_get_size (widget->window, &width, &height);
}
gtk_draw_shadow (widget->style, widget->window,
GTK_STATE_NORMAL, GTK_SHADOW_OUT,
x, y, width, height);
gdk_draw_rectangle (widget->window,
widget->style->black_gc,
FALSE,
x, y, width - 1, height - 1);
}
}
/*************************************************************
* gtk_drag_highlight_expose:
* Callback for expose_event for highlighted widgets.
* arguments:
* widget:
* event:
* data:
* results:
*************************************************************/
static gboolean
gtk_drag_highlight_expose (GtkWidget *widget,
GdkEventExpose *event,
gpointer data)
{
gtk_drag_highlight_paint (widget);
return TRUE;
}
/*************************************************************
* gtk_drag_highlight:
* Highlight the given widget in the default manner.
@ -660,33 +727,14 @@ gtk_drag_finish (GdkDragContext *context,
void
gtk_drag_highlight (GtkWidget *widget)
{
gint x, y;
gtk_signal_connect_after (GTK_OBJECT (widget), "draw",
GTK_SIGNAL_FUNC (gtk_drag_highlight_expose),
NULL);
gtk_signal_connect (GTK_OBJECT (widget), "expose_event",
GTK_SIGNAL_FUNC (gtk_drag_highlight_paint),
NULL);
g_return_if_fail (widget != NULL);
if (GTK_WIDGET_NO_WINDOW (widget))
{
x = widget->allocation.x;
y = widget->allocation.y;
}
else
{
x = 0;
y = 0;
}
gtk_draw_shadow (widget->style, widget->window,
GTK_STATE_NORMAL, GTK_SHADOW_OUT,
x, y,
widget->allocation.width,
widget->allocation.height);
gdk_draw_rectangle (widget->window,
widget->style->black_gc,
FALSE,
x, y,
widget->allocation.width - 1,
widget->allocation.height - 1);
gtk_widget_queue_draw (widget);
}
/*************************************************************
@ -700,25 +748,16 @@ gtk_drag_highlight (GtkWidget *widget)
void
gtk_drag_unhighlight (GtkWidget *widget)
{
gint x, y;
g_return_if_fail (widget != NULL);
if (GTK_WIDGET_NO_WINDOW (widget))
{
x = widget->allocation.x;
y = widget->allocation.y;
}
else
{
x = 0;
y = 0;
}
gtk_signal_disconnect_by_func (GTK_OBJECT (widget),
GTK_SIGNAL_FUNC (gtk_drag_highlight_paint),
NULL);
gtk_signal_disconnect_by_func (GTK_OBJECT (widget),
GTK_SIGNAL_FUNC (gtk_drag_highlight_expose),
NULL);
gdk_window_clear_area_e (widget->window,
x, y,
widget->allocation.width,
widget->allocation.height);
gtk_widget_queue_clear (widget);
}
/*************************************************************
@ -1097,6 +1136,12 @@ gtk_drag_find_widget (GtkWidget *widget,
if (data->found || !GTK_WIDGET_MAPPED (widget))
return;
/* Note that in the following code, we only count the
* position as being inside a WINDOW widget if it is inside
* widget->window; points that are outside of widget->window
* but within the allocation are not counted. This is consistent
* with the way we highlight drag targets.
*/
if (!GTK_WIDGET_NO_WINDOW (widget))
{
new_allocation.x = 0;
@ -1412,7 +1457,7 @@ gtk_drag_dest_drop (GtkWidget *widget,
else
{
/* We need to synthesize a motion event, wait for a status,
* and, if we get one a good one, do a drop.
* and, if we get a good one, do a drop.
*/
GdkEvent *current_event;