NSWindowDidUpdateNotification sent too often
NSWindowDidUpdateNotification sent too often
- Subject: NSWindowDidUpdateNotification sent too often
- From: Norbert Heger <email@hidden>
- Date: Tue, 18 Dec 2001 17:16:15 +0100
As some of you may have already noticed, my example at
http://homepage.mac.com/noheger/DisplayPerformance.tgz
also increments a counter whenever the window delegate receives a
NSWindowDidUpdateNotification. Obviously this notification is sent twice on
each mouse up/down event (4 times on each mouse click), which can also lead
to performance problems depending on how expensive your -windowDidUpdate:
implementation actually is (note that EVERY visible window's delegate will
receive that notification!)
The reason for this behavior seems to be the fact that, according to the
documentation, the notification is sent "on every pass through the event
loop" - and immediately before each mouse up/down event a second event
(type=SysDefined subtype=7 data1=1 data2=0 on mouseDown data2=1 on mouseUp)
is sent, causing the second update notification.
And another interesting observation: when you start the program by double
clicking the app icon in Finder (instead of launching it via Project
Builder), the app will generate tons of mouse-moved events (also causing the
corresponding update notifications) until you click into one of the app's
windows.
Best Regards, Norbert
_____________________________________________
Norbert Heger, Objective Development
http://www.obdev.at/