From fcf1813ac68788d7f52a2956fda940498f01a719 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Sat, 13 Jun 1998 01:38:01 +0000 Subject: [PATCH] Removed code for drawing the child in two places at once. Unfortunately, Fri Jun 12 21:20:42 1998 Owen Taylor * gtk/gtkoptionmenu.c (gtk_option_menu_expose): Removed code for drawing the child in two places at once. Unfortunately, not only does it not work anymore (because reparenting has been fixed), but it also triggers reparent/expose loops in some cases. * gtk/gtkoptionmenu.c (gtk_option_menu_remove_contents): Removed an unecessary unrealize. --- ChangeLog | 11 +++++++++++ ChangeLog.pre-2-0 | 11 +++++++++++ ChangeLog.pre-2-10 | 11 +++++++++++ ChangeLog.pre-2-2 | 11 +++++++++++ ChangeLog.pre-2-4 | 11 +++++++++++ ChangeLog.pre-2-6 | 11 +++++++++++ ChangeLog.pre-2-8 | 11 +++++++++++ gdk/gdkwindow.c | 6 ++++++ gdk/x11/gdkwindow-x11.c | 6 ++++++ gtk/gtkoptionmenu.c | 21 ++++++++++++++++++++- 10 files changed, 109 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e87f8a0964..9a2369a133 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Fri Jun 12 21:20:42 1998 Owen Taylor + + * gtk/gtkoptionmenu.c (gtk_option_menu_expose): Removed + code for drawing the child in two places at once. Unfortunately, + not only does it not work anymore (because reparenting has + been fixed), but it also triggers reparent/expose loops + in some cases. + + * gtk/gtkoptionmenu.c (gtk_option_menu_remove_contents): Removed + an unecessary unrealize. + Thu Jun 11 13:09:00 1998 Owen Taylor * gtk/gtktext.c (remove_cache_line): Fixed broken diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index e87f8a0964..9a2369a133 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,14 @@ +Fri Jun 12 21:20:42 1998 Owen Taylor + + * gtk/gtkoptionmenu.c (gtk_option_menu_expose): Removed + code for drawing the child in two places at once. Unfortunately, + not only does it not work anymore (because reparenting has + been fixed), but it also triggers reparent/expose loops + in some cases. + + * gtk/gtkoptionmenu.c (gtk_option_menu_remove_contents): Removed + an unecessary unrealize. + Thu Jun 11 13:09:00 1998 Owen Taylor * gtk/gtktext.c (remove_cache_line): Fixed broken diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index e87f8a0964..9a2369a133 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,14 @@ +Fri Jun 12 21:20:42 1998 Owen Taylor + + * gtk/gtkoptionmenu.c (gtk_option_menu_expose): Removed + code for drawing the child in two places at once. Unfortunately, + not only does it not work anymore (because reparenting has + been fixed), but it also triggers reparent/expose loops + in some cases. + + * gtk/gtkoptionmenu.c (gtk_option_menu_remove_contents): Removed + an unecessary unrealize. + Thu Jun 11 13:09:00 1998 Owen Taylor * gtk/gtktext.c (remove_cache_line): Fixed broken diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index e87f8a0964..9a2369a133 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,14 @@ +Fri Jun 12 21:20:42 1998 Owen Taylor + + * gtk/gtkoptionmenu.c (gtk_option_menu_expose): Removed + code for drawing the child in two places at once. Unfortunately, + not only does it not work anymore (because reparenting has + been fixed), but it also triggers reparent/expose loops + in some cases. + + * gtk/gtkoptionmenu.c (gtk_option_menu_remove_contents): Removed + an unecessary unrealize. + Thu Jun 11 13:09:00 1998 Owen Taylor * gtk/gtktext.c (remove_cache_line): Fixed broken diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index e87f8a0964..9a2369a133 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,14 @@ +Fri Jun 12 21:20:42 1998 Owen Taylor + + * gtk/gtkoptionmenu.c (gtk_option_menu_expose): Removed + code for drawing the child in two places at once. Unfortunately, + not only does it not work anymore (because reparenting has + been fixed), but it also triggers reparent/expose loops + in some cases. + + * gtk/gtkoptionmenu.c (gtk_option_menu_remove_contents): Removed + an unecessary unrealize. + Thu Jun 11 13:09:00 1998 Owen Taylor * gtk/gtktext.c (remove_cache_line): Fixed broken diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index e87f8a0964..9a2369a133 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,14 @@ +Fri Jun 12 21:20:42 1998 Owen Taylor + + * gtk/gtkoptionmenu.c (gtk_option_menu_expose): Removed + code for drawing the child in two places at once. Unfortunately, + not only does it not work anymore (because reparenting has + been fixed), but it also triggers reparent/expose loops + in some cases. + + * gtk/gtkoptionmenu.c (gtk_option_menu_remove_contents): Removed + an unecessary unrealize. + Thu Jun 11 13:09:00 1998 Owen Taylor * gtk/gtktext.c (remove_cache_line): Fixed broken diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index e87f8a0964..9a2369a133 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,14 @@ +Fri Jun 12 21:20:42 1998 Owen Taylor + + * gtk/gtkoptionmenu.c (gtk_option_menu_expose): Removed + code for drawing the child in two places at once. Unfortunately, + not only does it not work anymore (because reparenting has + been fixed), but it also triggers reparent/expose loops + in some cases. + + * gtk/gtkoptionmenu.c (gtk_option_menu_remove_contents): Removed + an unecessary unrealize. + Thu Jun 11 13:09:00 1998 Owen Taylor * gtk/gtktext.c (remove_cache_line): Fixed broken diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index b0db654990..e80717071a 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -815,6 +815,7 @@ gdk_window_reparent (GdkWindow *window, { GdkWindowPrivate *window_private; GdkWindowPrivate *parent_private; + GdkWindowPrivate *old_parent_private; g_return_if_fail (window != NULL); @@ -822,6 +823,7 @@ gdk_window_reparent (GdkWindow *window, new_parent = (GdkWindow*) &gdk_root_parent; window_private = (GdkWindowPrivate*) window; + old_parent_private = (GdkWindowPrivate*)window_private->parent; parent_private = (GdkWindowPrivate*) new_parent; if (!window_private->destroyed && !parent_private->destroyed) @@ -829,6 +831,10 @@ gdk_window_reparent (GdkWindow *window, window_private->xwindow, parent_private->xwindow, x, y); + + old_parent_private->children = g_list_remove (old_parent_private->children, window); + parent_private->children = g_list_prepend (parent_private->children, window); + } void diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index b0db654990..e80717071a 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -815,6 +815,7 @@ gdk_window_reparent (GdkWindow *window, { GdkWindowPrivate *window_private; GdkWindowPrivate *parent_private; + GdkWindowPrivate *old_parent_private; g_return_if_fail (window != NULL); @@ -822,6 +823,7 @@ gdk_window_reparent (GdkWindow *window, new_parent = (GdkWindow*) &gdk_root_parent; window_private = (GdkWindowPrivate*) window; + old_parent_private = (GdkWindowPrivate*)window_private->parent; parent_private = (GdkWindowPrivate*) new_parent; if (!window_private->destroyed && !parent_private->destroyed) @@ -829,6 +831,10 @@ gdk_window_reparent (GdkWindow *window, window_private->xwindow, parent_private->xwindow, x, y); + + old_parent_private->children = g_list_remove (old_parent_private->children, window); + parent_private->children = g_list_prepend (parent_private->children, window); + } void diff --git a/gtk/gtkoptionmenu.c b/gtk/gtkoptionmenu.c index 4b3f798cb0..228f496e6f 100644 --- a/gtk/gtkoptionmenu.c +++ b/gtk/gtkoptionmenu.c @@ -379,6 +379,18 @@ gtk_option_menu_expose (GtkWidget *widget, { gtk_option_menu_paint (widget, &event->area); + + /* The following code tries to draw the child in two places at + * once. It fails miserably for several reasons + * + * - If the child is not no-window, removing generates + * more expose events. Bad, bad, bad. + * + * - Even if the child is no-window, removing it now (properly) + * clears the space where it was, so it does no good + */ + +#if 0 remove_child = FALSE; child = GTK_BUTTON (widget)->child; @@ -401,6 +413,14 @@ gtk_option_menu_expose (GtkWidget *widget, if (remove_child) gtk_option_menu_remove_contents (GTK_OPTION_MENU (widget)); +#else + child = GTK_BUTTON (widget)->child; + child_event = *event; + if (child && GTK_WIDGET_NO_WINDOW (child) && + gtk_widget_intersect (child, &event->area, &child_event.area)) + gtk_widget_event (child, (GdkEvent*) &child_event); + +#endif /* 0 */ } return FALSE; @@ -491,7 +511,6 @@ gtk_option_menu_remove_contents (GtkOptionMenu *option_menu) if (GTK_WIDGET (option_menu->menu_item)->state != GTK_BUTTON (option_menu)->child->state) gtk_widget_set_state (GTK_BUTTON (option_menu)->child, GTK_WIDGET (option_menu->menu_item)->state); - gtk_widget_unrealize (GTK_BUTTON (option_menu)->child); gtk_widget_reparent (GTK_BUTTON (option_menu)->child, option_menu->menu_item); gtk_widget_unref (option_menu->menu_item); option_menu->menu_item = NULL;