gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Some diffs to optimize drawing


From: Benhur Stein
Subject: Some diffs to optimize drawing
Date: Wed, 29 Jan 2003 23:47:07 -0200
User-agent: Internet Messaging Program (IMP) 3.0

Hi all.

Here are some diffs to lots of classes in gui that do some 
optimizations in the way things are drawn.

Basically what is done is the following:

Remove lockFocus from draw methods in cell (and view) classes. Those
methods should always be called with focus locked. (see
http://docs.sun.com/db/doc/802-2112/6i63mn612?a=view#01.Classes-137

Added lock/unlock methods on other methods that call draw... methods.

Tried to diminish the frequency of calls to flushWindow.
Many changes have been made to NSMatrix in this area. I think this class
needs some refactoring or maybe some rewriting, it's very complex and uses
many different ways of doing the same things.

After applying this patch, 
a good place to see the difference is in GWorkspace, changing the selected file
using the keyboard. Before the patch, there are lots of updates to the screen
for each file selected. After the patch, only (or mostly) one, so screen updates
look much smoother.

There are lots of things still to be done.

- I didn't look into some of the classes.

Of the ones I looked, the ones that I think need some reworking (independently
of this patch) are:
- NSMatrix: it is too complex and probably wrong in some places (keyboard
navigation of radio buttons seems broken, for example).

- NSTableHeaderView -mouseDown is also too complex.
There are some calls in there to highlightCell with focus unlocked.

- NSBrowser -doClick ditto.

- one thing I think would simplify window flushing would be to use
the same mechanism that exists in NSWindow to make setNeedsDisplay work.
That is, everytime when the window notices that it needs to be 
displayed, it asks for a _handleWindowNeedsDisplay to be performed
when the runloop runs again, before getting the next event. This same
method could also be asked for when it needs to be flushed (it is
automatically done in unlockFocus) so that in most cases the window
would be automatically flushed without the need to explicitly call
flushWindow (it is not always easy to know if thw window should be flushed or
not, that is why there are so many calls to flushWindow in GNUstep).

Sorry for the poor english, hope some of it is understandable.

I'm sending this because I think it's something very interesting to be done in
GNUstep and I do not have all the time I'd like/need to do it all. It is in a
working state now and maybe somebody would like to work on this.

Have fun,
Benhur Stein

Attachment: gui-focus.diff.gz
Description: Unix tar archive


reply via email to

[Prev in Thread] Current Thread [Next in Thread]