SetHasFocus if we are the active application when the LLW is created, otherwise if the user switches to a different application before LLW is brought on screen then input is still registered (because we're bypassing the standard event model and getting the events directly from the hardware).

Also, ensure that the actual video mode params are set at all times and that the rate parameter is never zero.
This commit is contained in:
Steve Checkoway
2006-03-03 11:57:38 +00:00
parent 7793715749
commit 1214a91649
@@ -99,6 +99,8 @@ LowLevelWindow_Cocoa::LowLevelWindow_Cocoa() : m_Context(nil), m_BGContext(nil),
[mt performOnMainThread];
[mt release];
m_CurrentParams.windowed = true; // We are essentially windowed to begin with.
SetActualParamsFromMode( CGDisplayCurrentMode(kCGDirectMainDisplay) );
HOOKS->SetHasFocus( [NSApp isActive] );
}
LowLevelWindow_Cocoa::~LowLevelWindow_Cocoa()
@@ -369,8 +371,10 @@ int LowLevelWindow_Cocoa::ChangeDisplayMode( const VideoModeParams& p )
void LowLevelWindow_Cocoa::SetActualParamsFromMode( CFDictionaryRef mode )
{
SInt32 rate;
bool ret = CFNumberGetValue( (CFNumberRef)CFDictionaryGetValue(mode, CFSTR("RefreshRate")),
kCFNumberSInt32Type, &rate );
if( !CFNumberGetValue( (CFNumberRef)CFDictionaryGetValue(mode, CFSTR("RefreshRate")), kCFNumberSInt32Type, &rate) )
if( !ret || rate == 0)
rate = 60;
m_CurrentParams.rate = rate;