fix all workspaces bug [thx mmadia] and use ProposeMode mechanism for unfound modes

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5873 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
shatty 2004-01-02 07:12:00 +00:00
parent 7c0a9f8327
commit eb32778201

View File

@ -513,10 +513,12 @@ ScreenWindow::MessageReceived(BMessage* message)
int32 totalWorkspaces = count_workspaces();
fRevertButton->SetEnabled(false);
for (int32 count = 1; count <= totalWorkspaces; count++) {
for (int32 count = 0; count <= totalWorkspaces; count++) {
if (count != old) {
activate_workspace(count);
screen.SetMode(&mode, true);
}
}
activate_workspace(old);
@ -635,6 +637,7 @@ ScreenWindow::ApplyMode()
return;
display_mode requested_mode;
screen.GetMode(&requested_mode); // start with current mode timings
BString menuLabel = fResolutionMenu->FindMarked()->Label();
string_to_mode(menuLabel.String(),&requested_mode);
@ -658,17 +661,8 @@ ScreenWindow::ApplyMode()
}
if (supported_mode) {
requested_mode = *supported_mode;
} else {
display_mode proposed_mode = requested_mode;
// if (screen.ProposeMode(&proposed_mode,&proposed_mode,&proposed_mode) == B_ERROR) {
if (!mismatch_mode) {
BAlert * UnsupportedModeAlert =
new BAlert("UnsupportedModeAlert", "This mode is not supported.",
"Okay", NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
UnsupportedModeAlert->Go();
return;
}
proposed_mode = *mismatch_mode;
} else if (mismatch_mode) {
display_mode proposed_mode = *mismatch_mode;
BString string;
char str[256];
colorspace_to_string(requested_mode.space,str);
@ -688,6 +682,34 @@ ScreenWindow::ApplyMode()
return;
}
requested_mode = proposed_mode;
} else {
display_mode proposed_mode = requested_mode;
if (screen.ProposeMode(&proposed_mode,&requested_mode,&requested_mode) == B_ERROR) {
BAlert * UnsupportedModeAlert =
new BAlert("UnsupportedModeAlert", "This mode is not supported.",
"Okay", NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
UnsupportedModeAlert->Go();
return;
}
BString string;
char str[256];
colorspace_to_string(requested_mode.space,str);
string << str;
mode_to_string(requested_mode,str);
string << " is not supported at " << str << ". ";
string << "Use ";
colorspace_to_string(proposed_mode.space,str);
string << str;
mode_to_string(proposed_mode,str);
string << " at " << str << " instead?";
BAlert * BadModeAlert =
new BAlert("BadModeAlert", string.String(),
"Okay", "Cancel", NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
int32 button = BadModeAlert->Go();
if (button == 1) {
return;
}
requested_mode = proposed_mode;
}
float refresh;