peacha
2002.05.14, 06:53 AM
Hi all,
when I run a skeleton full screen app which switches res all the windows mess up once the app is done... I know it is normal if you do not capture the display... but I do
////////////////////////////////
typedef unsigned int uint;
int main ()
{
CFDictionaryRef originalMode;
originalMode = CGDisplayCurrentMode (kCGDirectMainDisplay);
CGDisplayCapture (kCGDirectMainDisplay);
CGDisplayHideCursor (kCGDirectMainDisplay);
if (!switchToMode (640, 480, 32))
{
// no error check yet!
}
CGDisplaySwitchToMode (kCGDirectMainDisplay, originalMode);
CFRelease (originalMode);
CGDisplayRelease (kCGDirectMainDisplay);
CGDisplayShowCursor (kCGDirectMainDisplay);
return 0;
}
bool switchToMode (uint newWidth, uint newHeight, uint newColorDepth)
{
CFDictionaryRef newMode;
boolean_t result;
newMode = CGDisplayBestModeForParameters (kCGDirectMainDisplay, newColorDepth, newWidth, newHeight, &result);
if (result)
result = (CGDisplaySwitchToMode (kCGDirectMainDisplay, newMode) == kCGErrorSuccess);
CFRelease (newMode);
return result;
}
//////////////////////////////////
Any help??? Thx
when I run a skeleton full screen app which switches res all the windows mess up once the app is done... I know it is normal if you do not capture the display... but I do
////////////////////////////////
typedef unsigned int uint;
int main ()
{
CFDictionaryRef originalMode;
originalMode = CGDisplayCurrentMode (kCGDirectMainDisplay);
CGDisplayCapture (kCGDirectMainDisplay);
CGDisplayHideCursor (kCGDirectMainDisplay);
if (!switchToMode (640, 480, 32))
{
// no error check yet!
}
CGDisplaySwitchToMode (kCGDirectMainDisplay, originalMode);
CFRelease (originalMode);
CGDisplayRelease (kCGDirectMainDisplay);
CGDisplayShowCursor (kCGDirectMainDisplay);
return 0;
}
bool switchToMode (uint newWidth, uint newHeight, uint newColorDepth)
{
CFDictionaryRef newMode;
boolean_t result;
newMode = CGDisplayBestModeForParameters (kCGDirectMainDisplay, newColorDepth, newWidth, newHeight, &result);
if (result)
result = (CGDisplaySwitchToMode (kCGDirectMainDisplay, newMode) == kCGErrorSuccess);
CFRelease (newMode);
return result;
}
//////////////////////////////////
Any help??? Thx