Win32: Added debug to dispaly mode switching and removed the DM_DISPLAYFLAGS flag

This commit is contained in:
Elias Naur 2005-12-26 15:06:45 +00:00
parent 9dfd46ba6f
commit 42e1a8a8c0
1 changed files with 65 additions and 68 deletions

View File

@ -60,8 +60,6 @@ static WORD currentGamma[GAMMA_SIZE]; // Current gamma settings
static DEVMODE devmode; // Now we'll remember this value for the future
extern HWND display_hwnd; // Handle to the window
jobjectArray getAvailableDisplayModes(JNIEnv *env)
{
jobjectArray result = GetAvailableDisplayModesEx(env);
@ -146,22 +144,21 @@ void switchDisplayMode(JNIEnv * env, jobject mode)
devmode.dmBitsPerPel = bpp;
devmode.dmPelsWidth = width;
devmode.dmPelsHeight = height;
devmode.dmDisplayFlags = 0;
devmode.dmDisplayFrequency = freq;
devmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFLAGS;
devmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
if (freq != 0)
devmode.dmFields |= DM_DISPLAYFREQUENCY;
cdsret = ChangeDisplaySettings(&devmode, CDS_FULLSCREEN);
if (cdsret != DISP_CHANGE_SUCCESSFUL) {
// Failed: so let's check to see if it's a wierd dual screen display
printfDebugJava(env, "Failed to set display mode... assuming dual monitors");
printfDebugJava(env, "Failed to set display mode (%ld) ... assuming dual monitors", cdsret);
devmode.dmPelsWidth = width * 2;
cdsret = ChangeDisplaySettings(&devmode, CDS_FULLSCREEN);
if (cdsret != DISP_CHANGE_SUCCESSFUL) {
printfDebugJava(env, "Failed to set display mode using dual monitors");
throwException(env, "Failed to set display mode.");
printfDebugJava(env, "Failed to set display mode using dual monitors (%ld)", cdsret);
throwFormattedException(env, "Failed to set display mode (%ld).", cdsret);
return;
}
}