Screen: disable Apply button when no changes would be made.
* Previously this would work only in "current workspace" mode. * Also avoid calling count_workspaces in a loop since its result is not cached and it needs to ask app_server each time. * Fixes #4231. Signed-off-by: Adrien Destugues <[email protected]>
This commit is contained in:
@@ -1215,8 +1215,24 @@ ScreenWindow::_BuildSupportedColorSpaces()
|
|||||||
void
|
void
|
||||||
ScreenWindow::_CheckApplyEnabled()
|
ScreenWindow::_CheckApplyEnabled()
|
||||||
{
|
{
|
||||||
fApplyButton->SetEnabled(fSelected != fActive
|
bool applyEnabled = true;
|
||||||
|| fAllWorkspacesItem->IsMarked());
|
|
||||||
|
if (fSelected == fActive) {
|
||||||
|
applyEnabled = false;
|
||||||
|
if (fAllWorkspacesItem->IsMarked()) {
|
||||||
|
screen_mode screenMode;
|
||||||
|
const int32 workspaceCount = count_workspaces();
|
||||||
|
for (int32 i = 0; i < workspaceCount; i++) {
|
||||||
|
fScreenMode.Get(screenMode, i);
|
||||||
|
if (screenMode != fSelected) {
|
||||||
|
applyEnabled = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fApplyButton->SetEnabled(applyEnabled);
|
||||||
|
|
||||||
uint32 columns;
|
uint32 columns;
|
||||||
uint32 rows;
|
uint32 rows;
|
||||||
@@ -1337,7 +1353,8 @@ ScreenWindow::_Apply()
|
|||||||
|
|
||||||
if (fAllWorkspacesItem->IsMarked()) {
|
if (fAllWorkspacesItem->IsMarked()) {
|
||||||
int32 originatingWorkspace = current_workspace();
|
int32 originatingWorkspace = current_workspace();
|
||||||
for (int32 i = 0; i < count_workspaces(); i++) {
|
const int32 workspaceCount = count_workspaces();
|
||||||
|
for (int32 i = 0; i < workspaceCount; i++) {
|
||||||
if (i != originatingWorkspace)
|
if (i != originatingWorkspace)
|
||||||
screen.SetMode(i, &newMode, true);
|
screen.SetMode(i, &newMode, true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user