From 1214a91649e1ae1f5b569cf53195e64880ceb552 Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Fri, 3 Mar 2006 11:57:38 +0000 Subject: [PATCH] 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. --- stepmania/src/arch/LowLevelWindow/LowLevelWindow_Cocoa.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_Cocoa.mm b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_Cocoa.mm index 64333fd0f1..e74699fad3 100644 --- a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_Cocoa.mm +++ b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_Cocoa.mm @@ -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;