After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 113040 - Do predictive exposes for override redirect windows
Do predictive exposes for override redirect windows
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: X11
2.4.x
Other Linux
: High normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2003-05-15 08:02 UTC by Eugenia Loli-Queru
Modified: 2011-02-04 16:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to do this for both override redirect and child windows. (948 bytes, patch)
2004-04-13 23:34 UTC, Soren Sandmann Pedersen
none Details | Review
patch (5.19 KB, patch)
2004-06-12 16:20 UTC, Soren Sandmann Pedersen
none Details | Review

Description Eugenia Loli-Queru 2003-05-15 08:02:26 UTC
I use a number of different Linux distros and FreeBSD. They _all_ have 
the same problem on this PIII 700 Mhz (and on my dual-Celeron 533). If I 
use Abiword 1.9x, Galeon 1.3.x and any other "heavy" GTK+ 2.x application 
(and that includes even Nautilus) the context menus for these apps are 
just very slow. What I mean is this:
Use a 2-year old PC, get Galeon 1.3.x, load a web page, right click 
anywhere on that page. The first thing you will see is the actual menu 
window drawing and AFTER a short while, you will see this menu window 
getting populated by its menu options. It is just slow. Sure, it only 
takes a second or something, but compared to ALL other OSes and toolkits 
I use (and that even includes GTK+ 1.x), this behavior really makes me 
feel that GTK+ context menus are crawilingly slow. As I noted above, 
other complex GTK+ 2.x apps also exhibit the problem, depending in the 
complexity of the drawed background. When right clicking in the Gnome 
desktop, even Nautilus' context menu is not as fast as it should have 
been. Sure, it ain't as slow as Galeon or AbiWord, but it is still not as 
responsive as it should have been.

It happens on all my distros and FreeBSD, and please note I have all the 
needed Xfree extensions and 2D acceleration ON.

Is there any profiling and optimizations scheduled for GTK+ 2.4.x? 
Please... :)
Comment 1 Ross Burton 2003-05-15 11:15:17 UTC
I'm not a GTK+ coder, but until last month I had a 500MHz Pentium, and
never saw any slowness in context menus (Geforce2 MX graphics card).

Does this delay really occur in all applications? Try gedit -- the
complexity of the background shouldn't affect drawing speed for the menu.
Comment 2 Owen Taylor 2003-05-15 18:13:18 UTC
Hmm, I don't see this with most GTK+ apps. I don't use
Galeon so maybe it is a Galeon problem.

In nautilus, after it's been sitting there for a few
hours unused, the right click root menu popup is
instaneous for me on a 1.13ghz PIII ... a little faster
than your machine, but not a whole lot.

There are some Pango performance improvements upstream,
but your describing something so drastic that whether
we can lay out 200,000 characters a second or 500,000
a second isn't going to make a bit of difference.
Comment 3 Havoc Pennington 2003-05-15 18:21:16 UTC
Galeon 2 context menu pops up instantly for me.
Comment 4 Eugenia Loli-Queru 2003-05-15 18:22:42 UTC
>Does this delay really occur in all applications? Try gedit

On Gedit is much faster. But Nautilus, Galeon, Epiphany AND Abiword 
1.9.x and any other "complex" app exhibit the problem of the slow 
context menu rendering/display.

>the right click root menu popup is instaneous for me on a 1.13ghz 
PIII

Actually this is quite faster than a PIII 700 or even more, my dual 
celeron 533 (256 MB RAM). Could you please load a page with Galeon 
1.3.x, Epiphany or Abiword 1.3.x or any other "real" app (as opposed 
to  a utility) on a PII or Celeron machine and then check out the 
speed of its context menu? Here, it is considerably slow, I can see 
the actual creation of the window and then the population of the 
menu options. It overall doesn't take more than 1 or 1.3 seconds, 
but it is visibly slower than any other toolkit or OS I use in these 
machines. Thanks. :)
Comment 5 Tony Gale 2003-05-16 08:43:52 UTC
My PII-450MHz (dual) with RH9 doesn't have this problem. The only
thing I can suggest is memory exhaustion is causing it. What does
vmstat show?
Comment 6 Anders Carlsson 2003-05-16 08:56:16 UTC
FWIW, I've seen this problem on machines with NVidia drivers.
Definitely not a gtk+ issue there.
Comment 7 Tony Gale 2003-05-16 09:01:57 UTC
I'm using Nvidia drivers on the PII-450 above (it's the only reason it
feels even remotely usable) without this issue.

Note though, that some versions of the Nvidia drivers appear to leak
memory quite badly which results in major slowdown after a week or two
of Xwindows uptime. Ctrl-Alt-Backspace time.
Comment 8 Eugenia Loli-Queru 2003-05-16 19:25:31 UTC
I use a Voodoo5 and a Matrox G400 for these machines. My nvidia card 
is on another much faster machine here (AthlonXP 1600+) so the Linux 
distros in that faster machine don't exhibit the problem (and 
regarding nvidia, I only use the plain "nv"  driver, as the nvidia 
drivers crash on that machine because of the VIA chipset (nvidia 
knows of this)). So, I really don't think it is a driver problem... 
Is there something I can do to "measure" GTK+ 2.x performance and 
give you some hard numbers, in regards to galeon or abiword or other 
more advanced apps? I am convinced that this is simply a perfomance 
problem that I see because I use many different OSes and toolkits. 
Other people, might see the same lag in context menu performance on 
these apps and take it for granted, if they don't use much other 
OSes/toolkits... It is one of these things that is hard to prove 
unless you are sitting next to me. :D
Comment 9 Owen Taylor 2003-05-19 21:29:41 UTC
Actually, on rare occasions, I think I have seen what you
are talking about - I'll pop up a menu and it will stick
for a fraction of a second before redrawing.

Probably what is happening is that between popping up
the menu and handling the expose something else gets
scheduled and takes a while before returning control
to the app.

I really have no idea if this is your problem or not,
if it is, there is one thing that we can do to fix help it.

Currently, the sequence for drawing any window is:

 A) Pop up window
 B) Wait for window to get mapped
 C) Handle expose events generated for mapping

But actually, menus are a special sort of window - "override
redirect", and step B) isn't necessary. Normally step
B) is there to wait for the window manager to map the window,
but the window manager isn't involved for menus.

So, by special-casing override redirect windows, we should
be able to get rid of the context switch to the X server
and back between popping up the window and drawing it,
which will make it less likely that some other process
gets scheduled in between.

It's probably about a half day of work to implement.

Then again, this might not be your problem at all...
Comment 10 Eugenia Loli-Queru 2003-05-19 21:49:32 UTC
Please implement it for GTK+ 2.4 and when Gnome 2.4 comes out, I 
will retry it and let you know if it's fixed. I guess, that's the 
only way to find out if this is the case indeed. Except if you are 
vising the Bay Area, in which case you can always come by and have a 
look at it first hand. :-)
Comment 11 Manuel Clos 2004-02-02 23:28:11 UTC
Try a right click on the any window title (running metacity). This
will show a popup menu with no icons. Tell if it feels slow. Perhaps
the delay is because of loading icons or such.
Comment 12 Eugenia Loli-Queru 2004-02-02 23:32:43 UTC
>Try a right click on the any window title (running metacity). 

This comes up immediately without a lag indeed.

However, doing a right-click on Epiphany also comes up immediately 
and that menu does have icons, so I don't think the icons are the 
culprit here.

You see, if you load Preferences/File_Management it will have the 
lag and the flickering, even if there are no icons in that window.
Comment 13 Soren Sandmann Pedersen 2004-04-13 23:34:11 UTC
Created attachment 26639 [details] [review]
Patch to do this for both override redirect and child windows.
Comment 14 Owen Taylor 2004-06-07 20:27:40 UTC
Patch looks good, with two comments:

 - It's possible to have override-redirect windows that aren't
   GDK_WINDOW_TEMP. To keep things clean, I think I'd put a
   guint override_redirect : 1 at the end of GdkWindowImplX11 - 
   (there is space there.) This also lets us ix a problem
   in gdk_window_reparent() where if we reparent a window
   to a child and back we lose the fact that it is override
   redirect but it stays override redirect.

 - Is adding a gdk_window_is_viewable() check a worthwhile
   optimization? We generally map windows leaf-nodes first.
Comment 15 Soren Sandmann Pedersen 2004-06-12 16:16:22 UTC
I noticed a problem with tooltips not redrawing correctly with this patch. When
a new tooltip is shown, this happens:

   - The tooltip window is unmapped
   - The label is changed
   - gtk_window_show() is called, which resizes the window to its new size
     and calls size_allocate. It doesn't bump the configure_event_count
     counter.
   - Since tooltip windows are toplevels, GDK waits for the ConfigureNotify
     to arrive before updating the width/height
   - The tooltip window is mapped and invalidated, but since GDK don't know the
     new size, only the old part of the window is invalidated.
   - GTK paints the new contents, but GDK clips it to the old position. 
     The tooltip drawing code uses the size of the GDK window to draw the
     black border, tooltip is drawn as if the window didn't change size.
   - The ConfigureNotify arrives. Windows generally aren't invalidated 
     here. 
   - A MapNotify arrives
   - An expose for the window arrives, but the 'old' part of the window is
     antiexposed because we invalidated ourselves. So only the new part is
     drawn.

The tooltip widget is not doing anything wrong. It is relying on not getting
exposes before the window has its final size, which is fair enough. The new
patch fixes this problem by updating the geometry information immediately when a
n override_redirect window is moved or resized.

The new patch also has an override_redirect flag and the is_viewable() optimization.
Comment 16 Soren Sandmann Pedersen 2004-06-12 16:20:49 UTC
Created attachment 28639 [details] [review]
patch
Comment 17 Elijah Newren 2004-06-19 18:43:05 UTC
Mass changing gtk+ bugs with target milestone of 2.4.2 to target 2.4.4, as
Matthias said he was trying to do himself on IRC and was asking for help with. 
If you see this message, it means I was successful at fixing the borken-ness in
bugzilla :)  Sorry for the spam; just query on this message and delete all
emails you get with this message, since there will probably be a lot.
Comment 18 Matthias Clasen 2004-07-03 06:17:49 UTC
Moving this to 2.6, since we want to test it there first.
Comment 19 Owen Taylor 2004-07-08 18:14:42 UTC
I'm not really sure what the changes to track the position of override
redirect windows have to do with the other parts of that bug. Is the
split between this and bug 113310 correct? But the patch looks correct
and good to commit.

Comment 20 Owen Taylor 2004-07-08 18:15:40 UTC
Ah, misssed the comment above about tracking the size.
Comment 21 Soren Sandmann Pedersen 2004-07-09 21:27:25 UTC
Fri Jul  9 23:26:09 2004  Soeren Sandmann  <sandmann@daimi.au.dk>

	* gdk/x11/gdkwindow-x11.h (struct _GdkWindowImplX11): Add an
	"override_redirect" bit.

	* gdk/x11/gdkwindow-x11.c (gdk_window_new): Set it here.
	
	* gdk/x11/gdkwindow-x11.c (gdk_window_move, gdk_window_resize,
	gdk_window_move_resize): 
	Update the local size/position cache
	immediately for override redirect windows.

	* gdk/x11/gdkwindow-x11.c (show_window_internal): Invalidate
	newly mapped child and override redirect windows.