Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 26 additions & 24 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,30 +123,32 @@ static int myCvErrorCallback( int /*status*/, const char* /*func_name*/,

int main(int argc, char *argv[])
{
// DFTFringe doesn't have a good darkmode palette
// one could call "DFTFringe.exe -platform windows:darkmode=1" to disable dark mode (except for app borders)
// Following code adds the platform argument programmatically

// Create a new argv array with existing args plus platform args
int newArgc = argc + 2;
std::vector<std::string> args;
args.reserve(newArgc);
// Copy existing arguments
for (int i = 0; i < argc; ++i) {
args.emplace_back(argv[i]);
}
// Add new arguments
args.emplace_back("-platform");
args.emplace_back("windows:darkmode=1");
// Build non-const char* array
std::vector<char*> newArgv;
newArgv.reserve(newArgc);
for (auto &arg : args) {
newArgv.push_back(&arg[0]); // C++11 guarantees contiguous storage
}

// Allow secondary instances
SingleApplication app( newArgc, newArgv.data(), true );
#ifdef _WIN32
// DFTFringe doesn't have a good darkmode palette
// one could call "DFTFringe.exe -platform windows:darkmode=1" to disable dark mode (except for app borders)
// Following code adds the platform argument programmatically
// Create a new argv array with existing args plus platform args
int newArgc = argc + 2;
std::vector<std::string> args;
args.reserve(newArgc);
// Copy existing arguments
for (int i = 0; i < argc; ++i) {
args.emplace_back(argv[i]);
}
// Add new arguments
args.emplace_back("-platform");
args.emplace_back("windows:darkmode=1");
// Build non-const char* array
std::vector<char*> newArgv;
newArgv.reserve(newArgc);
for (auto &arg : args) {
newArgv.push_back(&arg[0]); // C++11 guarantees contiguous storage
}
// Allow secondary instances
SingleApplication app( newArgc, newArgv.data(), true );
#else
SingleApplication app( argc, argv, true );
#endif

MessageReceiver msgReceiver;

Expand Down
Loading