Avoid AppearanceResult::Success conflict with X11 constant

X11/X.h #defines Success as 0, resulting in compilation errors due to a
name clash if this header happens to be included before wx/app.h.

We could #undef Success here, but it seems better to avoid the problem
by just renaming our constant, which was introduced only recently and so
shouldn't be used in many places yet.

See #24633.
This commit is contained in:
Vadim Zeitlin
2024-07-04 01:11:31 +02:00
parent f43779df34
commit 8cba40bad1
6 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -686,7 +686,7 @@ public:
enum class AppearanceResult
{
Failure,
Success,
Ok,
CannotChange
};
+3 -3
View File
@@ -985,7 +985,7 @@ public:
enum class AppearanceResult
{
Failure, ///< Changing the appearance failed.
Success, ///< Appearance was successfully changed.
Ok, ///< Appearance was successfully changed.
CannotChange ///< Appearance can't be changed any more.
};
@@ -998,7 +998,7 @@ public:
Appearance::Light or Appearance::Dark parameters if you need to
override the default system appearance. The effect of calling this
function is immediate, i.e. this function returns
AppearanceResult::Success, and affects all the existing windows as well
AppearanceResult::Ok, and affects all the existing windows as well
as any windows created after this call.
Under MSW, the default appearance is always light and the applications
@@ -1013,7 +1013,7 @@ public:
Note that to query the current appearance, you can use
wxSystemAppearance, see wxSystemSettings::GetAppearance().
@return AppearanceResult::Success if the appearance was successfully
@return AppearanceResult::Ok if the appearance was successfully
changed or had been already set to the requested value,
AppearanceResult::CannotChange if the appearance can't be changed
any more because it's too late to do it but could be changed if
+1 -1
View File
@@ -573,7 +573,7 @@ bool MyApp::DoSetAppearance(int menuId)
wxLogStatus("Appearance couldn't be changed.");
break;
case wxApp::AppearanceResult::Success:
case wxApp::AppearanceResult::Ok:
wxLogStatus("Appearance changed successfully.");
return true;
+1 -1
View File
@@ -370,7 +370,7 @@ wxApp::AppearanceResult wxApp::SetAppearance(Appearance appearance)
break;
}
return wxGTKImpl::UpdateColorScheme(colorScheme) ? AppearanceResult::Success
return wxGTKImpl::UpdateColorScheme(colorScheme) ? AppearanceResult::Ok
: AppearanceResult::Failure;
#else
wxUnusedVar(appearance);
+2 -2
View File
@@ -271,7 +271,7 @@ wxApp::AppearanceResult wxApp::SetAppearance(Appearance appearance)
case Appearance::Light:
// Nothing to do, this is the default.
return AppearanceResult::Success;
return AppearanceResult::Ok;
case Appearance::Dark:
flags = DarkMode_Always;
@@ -279,7 +279,7 @@ wxApp::AppearanceResult wxApp::SetAppearance(Appearance appearance)
}
// Do (try to) change it.
return MSWEnableDarkMode(flags) ? AppearanceResult::Success
return MSWEnableDarkMode(flags) ? AppearanceResult::Ok
: AppearanceResult::Failure;
}
+1 -1
View File
@@ -492,7 +492,7 @@ wxApp::AppearanceResult wxApp::SetAppearance(Appearance appearance)
[NSApp setAppearance:[NSAppearance appearanceNamed:name]];
return AppearanceResult::Success;
return AppearanceResult::Ok;
}
#endif // macOS 10.14+