From b901d98816c48446a363b0f7d00be73f4509741f Mon Sep 17 00:00:00 2001 From: rfm Date: Fri, 30 Jan 2009 13:06:15 +0000 Subject: [PATCH] Fix for #25384 git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27733 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 11 +++++++++++ Source/NSApplication.m | 29 ++++++++++++++--------------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5ad2f010b..44c1d75cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2009-01-30 Richard Frith-Macdonald + + * Source/NSApplication.m: Try to get behavior to match MacOS-X + by moving call to -updateWindows to be done before getting the + next event. Updating is done only if it was flagged as needing + to be done since the last update, but if we are in NSDefaultRunLoopMode + or NSModalRunLoopMode we automatically set the flag before handling + each event ... so unless the application explicitly turns it off, + it's always done in these modes. + Should fix #25384 + 2009-01-29 Fred Kiefer * Source/NSParagraphStyle.m: Fix all copying code to handle diff --git a/Source/NSApplication.m b/Source/NSApplication.m index 3dbd0fb16..6305f1e98 100644 --- a/Source/NSApplication.m +++ b/Source/NSApplication.m @@ -579,9 +579,9 @@ static NSSize scaledIconSizeForSize(NSSize imageSize) while (!done) { theEvent = [NSApp nextEventMatchingMask: eventMask - untilDate: theDistantFuture - inMode: NSEventTrackingRunLoopMode - dequeue: YES]; + untilDate: theDistantFuture + inMode: NSEventTrackingRunLoopMode + dequeue: YES]; switch ([theEvent type]) { @@ -1427,12 +1427,6 @@ static NSSize scaledIconSizeForSize(NSSize imageSize) } } - // send an update message to all visible windows - if (_windows_need_update) - { - [self updateWindows]; - } - DESTROY (_runLoopPool); } @@ -1721,10 +1715,6 @@ See Also: -runModalForWindow: { [self stopModal]; } - if (_windows_need_update) - { - [self updateWindows]; - } } RELEASE (pool); } @@ -1963,6 +1953,10 @@ See -runModalForWindow: { NSEvent *event; + if (_windows_need_update) + { + [self updateWindows]; + } if (!expiration) expiration = [NSDate distantFuture]; @@ -1980,6 +1974,7 @@ IF_NO_GC(NSAssert([event retainCount] > 0, NSInternalInconsistencyException)); */ if (mode != NSEventTrackingRunLoopMode && event != null_event) { + _windows_need_update = YES; if ([NSCursor isHiddenUntilMouseMoves]) { NSEventType type = [event type]; @@ -2434,6 +2429,9 @@ image.

See Also: -applicationIconImage

* Set whether the main run loop will request all visible windows update * themselves after the current or next event is processed. (Update occurs * after event dispatch in the loop.) + * This is needed when in NSEventTrackingRunLoopMode. When the application + * is using NSDefaultRunLoopMode or NSModalRunLoopMode windows are updated + * after each loop iteration irrespective of this setting. */ - (void) setWindowsNeedUpdate: (BOOL)flag { @@ -2442,8 +2440,9 @@ image.

See Also: -applicationIconImage

/** * Sends each of the app's visible windows an [NSWindow-update] message. - * This method is called once per iteration of the main run loop managed - * by -run . + * This method is called automatically for every iteration of the run loop + * in NSDefaultRunLoopMode or NSModalRunLoopMode, but is only called during + * NSEventTrackingRunLoopMode if -setWindowsNeedUpdate: is set to YES. */ - (void) updateWindows {