GraphicsExpose (was Re: [gtk-list] About the About Box)




> There is most likely something wrong with the pixmap code somewhere,
> although there are no obvious bugs.  Perhaps GDK sometimes chokes on the
> NoExpose events generated.  That would be easy to test by changing the GC
> to not generate NoExpose events.  Humm.  I hadn't thought of that.

I looked some more into why the About box still eats a ton of memory
and performs rather poorly. The problem is definitely that thousands
of NoExpose events are being generated and queued. Changing the GC
made things work a lot better.

I think the necessary change should be made in GDK, not in the GIMP

Let me explain briefly what GraphicsExpose/NoExpose events are for
those who aren't familiar.

When copying with XCopyArea (gdk_draw_pixmap) into a window, if
the source region includes portions that are not in the source,
GraphicsExpose events are generated for the corresponding region.
If no GraphicsExpose events are generated, then a NoExpose event
is generated. Whether this happens or not is a function of the
GC (gdk_gc_set_exposures). The default is that it does happen.

This has essentially one use - when scrolling a window on the screen
using XCopyArea. You simply make an XCopyArea call from the calculated
original area of the window to the entire new window. If some of the
original portions weren't actually on screen, X will generate
GraphicsExpose events for those portions, and then you can fill them
in.

For an example of this in straight X, see:

http://x1.dejanews.com/getdoc.xp?recnum=3828716&server=db95q4&CONTEXT=882073985.1739129000

GDK translates GraphicsExpose events into ordinary expose events
which is approximately right in the above case but disasterously
wrong when copying from a pixmap to the window. If you happen
to asks for an area off the pixmap, a GraphicsExpose
event will be generated, which becomes an GdkEventExpose, which
probably makes your program ask for that same not-present area
again which locks everything up solid.

As far as I know, only two pieces of code use gdk_draw_pixmap 
window-to-window copying for scrolling - the text widget and
scrolling in the GIMP. The code in the GIMP doesn't work properly
(probably because of the above mentioned timing issues) - try
scrolling a window with button-two that is partially obscured.
The Text widget doesn't seem to show this problem, but possibly
only because it is faster at doing the redrawing.


So, for starters, I would like to make no graphics expose events
the default for GDK created GC's. 

I'm not sure what to do about the translation of GraphicsExpose =>
Expose. I'll probably have to fix the code in the GIMP to figure
out what the right course is.

Comments? Objections? 

                                        Owen

(While I'm at it, 

  gint gdk_event_get     (GdkEvent     *event,
>>			  GdkEventFunc  pred,
			  gpointer      data);
 
 seems badly broken. 'pred' will generally get a pointer to an XEvent 
 (which makes some code in the GIMP incorrect). But may occasionally
 get a GdkEvent instead! This is easy to fix, at the cost of a 
 high penalty in calls to GdkEventTranslate.
)



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