From eb437560d35e11836eea5bac750e6f64e98d8632 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Fri, 5 Feb 1999 18:40:14 +0000 Subject: [PATCH] Adjust saved positions of children when resizing a guffaw_gravity = TRUE Fri Feb 5 13:23:50 1999 Owen Taylor * 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. --- ChangeLog | 27 ++++++-- ChangeLog.pre-2-0 | 27 ++++++-- ChangeLog.pre-2-10 | 27 ++++++-- ChangeLog.pre-2-2 | 27 ++++++-- ChangeLog.pre-2-4 | 27 ++++++-- ChangeLog.pre-2-6 | 27 ++++++-- ChangeLog.pre-2-8 | 27 ++++++-- gdk/gdkwindow.c | 14 +++++ gdk/x11/gdkwindow-x11.c | 14 +++++ gtk/gtkdnd.c | 133 +++++++++++++++++++++++++++------------- 10 files changed, 264 insertions(+), 86 deletions(-) diff --git a/ChangeLog b/ChangeLog index c9b3147e7f..ff2bf351df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +Fri Feb 5 13:23:50 1999 Owen Taylor + + * 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 + + * 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 * gtk/gtk[hv]paned.c (gtk_[hv]paned_size_allocate): @@ -35,12 +56,6 @@ Tue Feb 2 12:39:42 1999 Owen Taylor 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 - - * 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 * docs/gtk_tut.sgml: new sections on Layout and diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index c9b3147e7f..ff2bf351df 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,24 @@ +Fri Feb 5 13:23:50 1999 Owen Taylor + + * 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 + + * 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 * gtk/gtk[hv]paned.c (gtk_[hv]paned_size_allocate): @@ -35,12 +56,6 @@ Tue Feb 2 12:39:42 1999 Owen Taylor 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 - - * 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 * docs/gtk_tut.sgml: new sections on Layout and diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index c9b3147e7f..ff2bf351df 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,24 @@ +Fri Feb 5 13:23:50 1999 Owen Taylor + + * 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 + + * 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 * gtk/gtk[hv]paned.c (gtk_[hv]paned_size_allocate): @@ -35,12 +56,6 @@ Tue Feb 2 12:39:42 1999 Owen Taylor 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 - - * 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 * docs/gtk_tut.sgml: new sections on Layout and diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index c9b3147e7f..ff2bf351df 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,24 @@ +Fri Feb 5 13:23:50 1999 Owen Taylor + + * 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 + + * 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 * gtk/gtk[hv]paned.c (gtk_[hv]paned_size_allocate): @@ -35,12 +56,6 @@ Tue Feb 2 12:39:42 1999 Owen Taylor 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 - - * 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 * docs/gtk_tut.sgml: new sections on Layout and diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index c9b3147e7f..ff2bf351df 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,24 @@ +Fri Feb 5 13:23:50 1999 Owen Taylor + + * 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 + + * 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 * gtk/gtk[hv]paned.c (gtk_[hv]paned_size_allocate): @@ -35,12 +56,6 @@ Tue Feb 2 12:39:42 1999 Owen Taylor 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 - - * 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 * docs/gtk_tut.sgml: new sections on Layout and diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index c9b3147e7f..ff2bf351df 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,24 @@ +Fri Feb 5 13:23:50 1999 Owen Taylor + + * 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 + + * 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 * gtk/gtk[hv]paned.c (gtk_[hv]paned_size_allocate): @@ -35,12 +56,6 @@ Tue Feb 2 12:39:42 1999 Owen Taylor 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 - - * 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 * docs/gtk_tut.sgml: new sections on Layout and diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index c9b3147e7f..ff2bf351df 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,24 @@ +Fri Feb 5 13:23:50 1999 Owen Taylor + + * 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 + + * 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 * gtk/gtk[hv]paned.c (gtk_[hv]paned_size_allocate): @@ -35,12 +56,6 @@ Tue Feb 2 12:39:42 1999 Owen Taylor 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 - - * 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 * docs/gtk_tut.sgml: new sections on Layout and diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index c3fd225817..e6695e242a 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -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; diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index c3fd225817..e6695e242a 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -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; diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c index 612f1fc26b..6e4adfff6b 100644 --- a/gtk/gtkdnd.c +++ b/gtk/gtkdnd.c @@ -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; - } - - gdk_window_clear_area_e (widget->window, - x, y, - widget->allocation.width, - widget->allocation.height); + 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); + + 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;