Support for Windows dark mode and force option WIP
Use the new experimental wxWidgets API for dark mode on Windows. Also add an option to force dark mode on all platforms. Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
parent
7e1afcd37c
commit
08665c36c6
File diff suppressed because it is too large
Load Diff
|
@ -348,6 +348,7 @@ std::array<Option, kNbOptions>& Option::All() {
|
||||||
Option(OptionID::kUIAllowJoystickBackgroundInput, &g_owned_opts.allow_joystick_background_input),
|
Option(OptionID::kUIAllowJoystickBackgroundInput, &g_owned_opts.allow_joystick_background_input),
|
||||||
Option(OptionID::kUIHideMenuBar, &gopts.hide_menu_bar),
|
Option(OptionID::kUIHideMenuBar, &gopts.hide_menu_bar),
|
||||||
Option(OptionID::kUISuspendScreenSaver, &gopts.suspend_screensaver),
|
Option(OptionID::kUISuspendScreenSaver, &gopts.suspend_screensaver),
|
||||||
|
Option(OptionID::kUIForceDarkMode, &gopts.force_dark_mode),
|
||||||
|
|
||||||
/// Sound
|
/// Sound
|
||||||
Option(OptionID::kSoundAudioAPI, &gopts.audio_api),
|
Option(OptionID::kSoundAudioAPI, &gopts.audio_api),
|
||||||
|
|
|
@ -116,6 +116,7 @@ enum class OptionID {
|
||||||
kUIAllowJoystickBackgroundInput,
|
kUIAllowJoystickBackgroundInput,
|
||||||
kUIHideMenuBar,
|
kUIHideMenuBar,
|
||||||
kUISuspendScreenSaver,
|
kUISuspendScreenSaver,
|
||||||
|
kUIForceDarkMode,
|
||||||
|
|
||||||
/// Sound
|
/// Sound
|
||||||
kSoundAudioAPI,
|
kSoundAudioAPI,
|
||||||
|
|
|
@ -120,6 +120,7 @@ static constexpr std::array<Option::Type, kNbOptions> kOptionsTypes = {
|
||||||
/*kUIAllowJoystickBackgroundInput*/ Option::Type::kBool,
|
/*kUIAllowJoystickBackgroundInput*/ Option::Type::kBool,
|
||||||
/*kUIHideMenuBar*/ Option::Type::kBool,
|
/*kUIHideMenuBar*/ Option::Type::kBool,
|
||||||
/*kUISuspendScreenSaver*/ Option::Type::kBool,
|
/*kUISuspendScreenSaver*/ Option::Type::kBool,
|
||||||
|
/*kUIForceDarkMode*/ Option::Type::kBool,
|
||||||
|
|
||||||
/// Sound
|
/// Sound
|
||||||
/*kSoundAudioAPI*/ Option::Type::kAudioApi,
|
/*kSoundAudioAPI*/ Option::Type::kAudioApi,
|
||||||
|
|
|
@ -2622,6 +2622,7 @@ bool MainFrame::BindControls()
|
||||||
cb->Hide();
|
cb->Hide();
|
||||||
#endif // !HAVE_XSS
|
#endif // !HAVE_XSS
|
||||||
}
|
}
|
||||||
|
{ getcbb("ForceDarkMode", gopts.force_dark_mode); }
|
||||||
wxFilePickerCtrl* fp;
|
wxFilePickerCtrl* fp;
|
||||||
#define getfp(n, o, l) \
|
#define getfp(n, o, l) \
|
||||||
do { \
|
do { \
|
||||||
|
|
|
@ -72,6 +72,7 @@ extern struct opts_t {
|
||||||
/// UI Config
|
/// UI Config
|
||||||
bool hide_menu_bar = true;
|
bool hide_menu_bar = true;
|
||||||
bool suspend_screensaver = false;
|
bool suspend_screensaver = false;
|
||||||
|
bool force_dark_mode = false;
|
||||||
|
|
||||||
/// wxWindows
|
/// wxWindows
|
||||||
// wxWidgets-generated options (opaque)
|
// wxWidgets-generated options (opaque)
|
||||||
|
|
|
@ -374,7 +374,7 @@ bool wxvbamApp::OnInit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSetWorkingDirectory(cwd);
|
wxSetWorkingDirectory(cwd);
|
||||||
|
|
||||||
if (!config_file_.IsOk()) {
|
if (!config_file_.IsOk()) {
|
||||||
// Set up the default configuration file.
|
// Set up the default configuration file.
|
||||||
// This needs to be in a subdir to support other config as well.
|
// This needs to be in a subdir to support other config as well.
|
||||||
|
@ -434,6 +434,11 @@ bool wxvbamApp::OnInit() {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__WXMSW__) && wxCHECK_VERSION(3, 2, 3)
|
||||||
|
if (wxSystemAppearance::IsSystemDark())
|
||||||
|
MSWEnableDarkMode();
|
||||||
|
#endif
|
||||||
|
|
||||||
// process command-line options
|
// process command-line options
|
||||||
for (size_t i = 0; i < pending_optset.size(); i++) {
|
for (size_t i = 0; i < pending_optset.size(); i++) {
|
||||||
auto parts = strutils::split(pending_optset[i], wxT('='));
|
auto parts = strutils::split(pending_optset[i], wxT('='));
|
||||||
|
|
|
@ -18,6 +18,13 @@
|
||||||
<flag>wxALL</flag>
|
<flag>wxALL</flag>
|
||||||
<border>5</border>
|
<border>5</border>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="sizeritem">
|
||||||
|
<object class="wxCheckBox" name="ForceDarkMode">
|
||||||
|
<label>Force Dark Mode (requires restart)</label>
|
||||||
|
</object>
|
||||||
|
<flag>wxALL</flag>
|
||||||
|
<border>5</border>
|
||||||
|
</object>
|
||||||
<object class="sizeritem">
|
<object class="sizeritem">
|
||||||
<flag>wxALL|wxEXPAND</flag>
|
<flag>wxALL|wxEXPAND</flag>
|
||||||
<border>5</border>
|
<border>5</border>
|
||||||
|
|
Loading…
Reference in New Issue