Tk Source Code

View Ticket
Login
Ticket UUID: 3086887
Title: Aqua <Expose> events redraw whole subwindow
Type: Bug Version: obsolete: 8.6b1
Submitter: treectrl Created on: 2010-10-13 20:09:00
Subsystem: 66. Aqua Window Operations Assigned To: das
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2011-01-06 11:46:50
Resolution: Accepted Closed By: wordtech
    Closed on: 2011-01-06 00:15:42
Description:
Run the attached script in Cocoa 8.6 Wish.  It creates 2 toplevels titled "OK" and "FAIL" with a text widget and scrollbar in each toplevel.
The "FAIL" window has an additional frame widget around the text and scrollbar.

If you scroll the text widgets you can see <Expose> messages in the console showing the %h and %w fields of the <Expose> events.

For the "OK" window the height %h is what you'd expect, 15 pixels when one line is scrolled.
For the "FAIL" window the height %h is the height of the entire text widget, meaning the whole text widget gets redrawn during scrolling.

When I comment out the lines below in tkMacOSXWindowEvent.c GenerateUpdates() the problem goes away:

    if (!Tk_IsTopLevel(winPtr)) {
ChkErr(TkMacOSHIShapeUnion, boundsRgn, updateRgn, updateRgn);
HIShapeGetBounds(updateRgn, updateBounds);
    }
User Comments: wordtech added on 2011-01-06 07:15:42:

allow_comments - 1

Fixed.

treectrl added on 2010-10-16 06:05:11:
It seems to be an error for TkScrollWindow to result in <Expose> events.

If you look at the X11 implementation of TkScrollWindow it consumes and *discards* all <Expose>events generated by scrolling.

In addition the Carbon version does not generate <Expose> events, neither does the Win32 version.

treectrl added on 2010-10-14 10:47:38:
I've only been working with OSX for a few days now so I can't say what this change will break.  I suspect it might have something to do with transparent windows or some such.

I compiled TkTreeCtrl with 8.6 for the first time and noticed scrolling was horribly slow. 
In the TkTreeCtrl demo *all* 4 lists are redrawn anytime any one of them scrolls.

The problem is TkScrollWindow generates an update for part of the window.

das added on 2010-10-14 06:20:52:
I'm pleasantly surprised to hear that redrawing works correctly with this removed, have you tested this extensively with a variety of widgets/subwindow scenarios?

FWIW this has been in place since the dawn of time, the equivalent quickdraw code used to be

RectRgn(damageRgn, &bounds);
UnionRgn(damageRgn, updateRgn, updateRgn);
GetRegionBounds(updateRgn, updateBounds);

the intent appears to be to make sure whole widgets are redrawn when any part of them receives an update event.

I added the !Tk_IsTopLevel() check around this in TkCocoa at some point to improve drawing performance, but did not look into the subwindow case.

treectrl added on 2010-10-14 03:09:01:

File Added - 389857: expose-bug.tcl

Attachments: