fix 'NSWindow' may not respond to '+windowNumbersWithOptions'

conditionally reverts 1b89f986f0e7e6303c4e44cb1ca5d42a5c78c8d4

Change-Id: I13aa24286dab52c9e4af798c8b6d9bf407bb7069
Reviewed-on: https://gerrit.libreoffice.org/9760
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Douglas Mencken 2014-06-12 16:42:56 -04:00 committed by Caolán McNamara
parent b304628e4d
commit 47b520024a

View File

@ -165,14 +165,27 @@ static const struct ExceptionalKey
static AquaSalFrame* getMouseContainerFrame()
{
NSArray* aWindows = [NSWindow windowNumbersWithOptions:0];
AquaSalFrame* pDispatchFrame = NULL;
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
NSInteger nWindows = 0;
NSCountWindows( &nWindows );
NSInteger* pWindows = (NSInteger*)alloca( nWindows * sizeof(NSInteger) );
NSWindowList( nWindows, pWindows ); // NSWindowList is supposed to be in z-order front to back
for(int i = 0; i < nWindows && ! pDispatchFrame; i++ )
{
NSWindow* pWin = [NSApp windowWithWindowNumber: pWindows[i]];
if( pWin && [pWin isMemberOfClass: [SalFrameWindow class]] && [(SalFrameWindow*)pWin containsMouse] )
pDispatchFrame = [(SalFrameWindow*)pWin getSalFrame];
}
#else
NSArray* aWindows = [NSWindow windowNumbersWithOptions:0];
for(NSUInteger i = 0; i < [aWindows count] && ! pDispatchFrame; i++ )
{
NSWindow* pWin = [NSApp windowWithWindowNumber:[[aWindows objectAtIndex:i] integerValue]];
if( pWin && [pWin isMemberOfClass: [SalFrameWindow class]] && [(SalFrameWindow*)pWin containsMouse] )
pDispatchFrame = [(SalFrameWindow*)pWin getSalFrame];
}
#endif
return pDispatchFrame;
}