[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gtk-list] Re: [bug] in showing windows [tentative-patch] (fwd)
- To: Mnemonic Developers Mailinglist <dev@mnemonic.org>
- Subject: [gtk-list] Re: [bug] in showing windows [tentative-patch] (fwd)
- From: Remco van de Meent <remco@mnemonic.org>
- Date: Sun, 21 Sep 1997 20:06:02 +0200 (CEST)
Hello,
Here is another patch. Didn't try it yet, but it might help us in de
'strange' display behaviour we're experiencing sometimes :)
bye,
Remco
.-----------------------------------------------------------------------------.
| Remco van de Meent | remco@mnemonic.org |
| Mnemonic Browser Project | http://www.mnemonic.org |
`-----------------------------------------------------------------------------'
---------- Forwarded message ----------
Date: 21 Sep 1997 14:03:43 -0400
From: Owen Taylor <owt1@cornell.edu>
Reply-To: gtk-list@redhat.com
To: gtk-list@redhat.com
Cc: Dan Stromberg <strombrg@hydra.acs.uci.edu>
Subject: [gtk-list] Re: [bug] in showing windows [tentative-patch]
Resent-Date: 21 Sep 1997 18:01:57 -0000
Resent-From: gtk-list@redhat.com
Resent-cc: recipient list not shown:;
This problem is basically the same as the one I posted a patch
for yesterday for gtknotebook.c, just rearing it's ugly head
in a different place. This patch below fixes it in all places
I could find it. (but doesn't replace the notebook patch)
But I'm not completely convinced that this is the best way to
do things. Since the same code is being replicated in lots of
places, it might be better to add it to gtk_widget_set_parent.
Except that for the notebook, you don't automatically want to
map the window for the notebook widget, so this would problem
mean adding another parameter to set_parent().
Also, in regards to the example Tim gave, if you want a window
to shrink when you add a child after the window has already
been shown(), you have to call gtk_window_set_policy() with
auto_shrink set to true. Which is the real difference between
PLACE = 1, and PLACE = 3. (i.e., that difference will still
exist after this patch.)
The best thing to do is to always show() the toplevel window
after all child widgets have been set up, if possible. Among other
things, this makes sure that there will be no undesired redrawing.
Regards,
Owen
diff -c -r gtk+970916-prepatch/gtk/gtkbin.c gtk+970916/gtk/gtkbin.c
*** gtk+970916-prepatch/gtk/gtkbin.c Tue Sep 2 16:18:19 1997
--- gtk+970916/gtk/gtkbin.c Sun Sep 21 12:53:40 1997
***************
*** 227,232 ****
--- 227,243 ----
{
gtk_widget_set_parent (widget, GTK_WIDGET (container));
+ if (GTK_WIDGET_VISIBLE (widget->parent))
+ {
+ if (GTK_WIDGET_REALIZED (widget->parent) &&
+ !GTK_WIDGET_REALIZED (widget))
+ gtk_widget_realize (widget);
+
+ if (GTK_WIDGET_MAPPED (widget->parent) &&
+ !GTK_WIDGET_MAPPED (widget))
+ gtk_widget_map (widget);
+ }
+
bin->child = widget;
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (container))
diff -c -r gtk+970916-prepatch/gtk/gtkbox.c gtk+970916/gtk/gtkbox.c
*** gtk+970916-prepatch/gtk/gtkbox.c Tue Sep 2 16:07:05 1997
--- gtk+970916/gtk/gtkbox.c Sun Sep 21 13:00:00 1997
***************
*** 121,126 ****
--- 121,137 ----
gtk_widget_set_parent (child, GTK_WIDGET (box));
+ if (GTK_WIDGET_VISIBLE (GTK_WIDGET (box)))
+ {
+ if (GTK_WIDGET_REALIZED (GTK_WIDGET (box)) &&
+ !GTK_WIDGET_REALIZED (child))
+ gtk_widget_realize (child);
+
+ if (GTK_WIDGET_MAPPED (GTK_WIDGET (box)) &&
+ !GTK_WIDGET_MAPPED (child))
+ gtk_widget_map (child);
+ }
+
if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (box))
gtk_widget_queue_resize (child);
}
***************
*** 149,154 ****
--- 160,176 ----
gtk_widget_set_parent (child, GTK_WIDGET (box));
+ if (GTK_WIDGET_VISIBLE (GTK_WIDGET (box)))
+ {
+ if (GTK_WIDGET_REALIZED (GTK_WIDGET (box)) &&
+ !GTK_WIDGET_REALIZED (child))
+ gtk_widget_realize (child);
+
+ if (GTK_WIDGET_MAPPED (GTK_WIDGET (box)) &&
+ !GTK_WIDGET_MAPPED (child))
+ gtk_widget_map (child);
+ }
+
if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (box))
gtk_widget_queue_resize (child);
}
diff -c -r gtk+970916-prepatch/gtk/gtkbutton.c gtk+970916/gtk/gtkbutton.c
*** gtk+970916-prepatch/gtk/gtkbutton.c Mon Sep 15 00:04:01 1997
--- gtk+970916/gtk/gtkbutton.c Sun Sep 21 12:55:24 1997
***************
*** 783,788 ****
--- 783,799 ----
{
gtk_widget_set_parent (widget, GTK_WIDGET (container));
+ if (GTK_WIDGET_VISIBLE (widget->parent))
+ {
+ if (GTK_WIDGET_REALIZED (widget->parent) &&
+ !GTK_WIDGET_REALIZED (widget))
+ gtk_widget_realize (widget);
+
+ if (GTK_WIDGET_MAPPED (widget->parent) &&
+ !GTK_WIDGET_MAPPED (widget))
+ gtk_widget_map (widget);
+ }
+
button->child = widget;
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (container))
diff -c -r gtk+970916-prepatch/gtk/gtkpaned.c gtk+970916/gtk/gtkpaned.c
*** gtk+970916-prepatch/gtk/gtkpaned.c Tue Sep 2 19:27:18 1997
--- gtk+970916/gtk/gtkpaned.c Sun Sep 21 12:54:09 1997
***************
*** 304,309 ****
--- 304,320 ----
{
gtk_widget_set_parent (widget, GTK_WIDGET (paned));
+ if (GTK_WIDGET_VISIBLE (widget->parent))
+ {
+ if (GTK_WIDGET_REALIZED (widget->parent) &&
+ !GTK_WIDGET_REALIZED (widget))
+ gtk_widget_realize (widget);
+
+ if (GTK_WIDGET_MAPPED (widget->parent) &&
+ !GTK_WIDGET_MAPPED (widget))
+ gtk_widget_map (widget);
+ }
+
paned->child1 = widget;
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (paned))
***************
*** 320,325 ****
--- 331,347 ----
if (!paned->child2)
{
gtk_widget_set_parent (widget, GTK_WIDGET (paned));
+
+ if (GTK_WIDGET_VISIBLE (widget->parent))
+ {
+ if (GTK_WIDGET_REALIZED (widget->parent) &&
+ !GTK_WIDGET_REALIZED (widget))
+ gtk_widget_realize (widget);
+
+ if (GTK_WIDGET_MAPPED (widget->parent) &&
+ !GTK_WIDGET_MAPPED (widget))
+ gtk_widget_map (widget);
+ }
paned->child2 = widget;
diff -c -r gtk+970916-prepatch/gtk/gtktable.c gtk+970916/gtk/gtktable.c
*** gtk+970916-prepatch/gtk/gtktable.c Tue Sep 2 16:14:22 1997
--- gtk+970916/gtk/gtktable.c Sun Sep 21 13:09:23 1997
***************
*** 199,204 ****
--- 199,215 ----
gtk_widget_set_parent (child, GTK_WIDGET (table));
+ if (GTK_WIDGET_VISIBLE (GTK_WIDGET (table)))
+ {
+ if (GTK_WIDGET_REALIZED (GTK_WIDGET (table)) &&
+ !GTK_WIDGET_REALIZED (child))
+ gtk_widget_realize (child);
+
+ if (GTK_WIDGET_MAPPED (GTK_WIDGET (table)) &&
+ !GTK_WIDGET_MAPPED (child))
+ gtk_widget_map (child);
+ }
+
if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (table))
gtk_widget_queue_resize (child);
}
--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null