Added support for autodetecting the system monitor color profile also on Linux
Code borrowed from Geeqie
This commit is contained in:
@@ -304,57 +304,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void findDefaultMonitorProfile()
|
||||
{
|
||||
// Determine the first monitor default profile of operating system, if selected
|
||||
|
||||
defaultMonitorProfile.clear();
|
||||
|
||||
#ifdef WIN32
|
||||
// Get current main monitor. Could be fine tuned to get the current windows monitor(multi monitor setup),
|
||||
// but problem is that we live in RTEngine with no GUI window to query around
|
||||
HDC hDC = GetDC(nullptr);
|
||||
|
||||
if (hDC != nullptr) {
|
||||
if (SetICMMode(hDC, ICM_ON)) {
|
||||
char profileName[MAX_PATH + 1];
|
||||
DWORD profileLength = MAX_PATH;
|
||||
|
||||
if (GetICMProfileA(hDC, &profileLength, profileName)) {
|
||||
defaultMonitorProfile = Glib::ustring(profileName);
|
||||
defaultMonitorProfile = Glib::path_get_basename(defaultMonitorProfile);
|
||||
size_t pos = defaultMonitorProfile.rfind(".");
|
||||
|
||||
if (pos != Glib::ustring::npos) {
|
||||
defaultMonitorProfile = defaultMonitorProfile.substr(0, pos);
|
||||
}
|
||||
}
|
||||
|
||||
// might fail if e.g. the monitor has no profile
|
||||
}
|
||||
|
||||
ReleaseDC(NULL, hDC);
|
||||
}
|
||||
|
||||
#else
|
||||
// TODO: Add other OS specific code here
|
||||
#endif
|
||||
|
||||
if (options.rtSettings.verbose) {
|
||||
printf("Default monitor profile is: %s\n", defaultMonitorProfile.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
cmsHPROFILE getDefaultMonitorProfile()
|
||||
{
|
||||
return getProfile(defaultMonitorProfile);
|
||||
}
|
||||
|
||||
Glib::ustring getDefaultMonitorProfileName() const
|
||||
{
|
||||
return defaultMonitorProfile;
|
||||
}
|
||||
|
||||
cmsHPROFILE workingSpace(const Glib::ustring& name) const
|
||||
{
|
||||
const ProfileMap::const_iterator r = wProfiles.find(name);
|
||||
@@ -628,21 +577,6 @@ void rtengine::ICCStore::init(const Glib::ustring& usrICCDir, const Glib::ustrin
|
||||
implementation->init(usrICCDir, stdICCDir, loadAll);
|
||||
}
|
||||
|
||||
void rtengine::ICCStore::findDefaultMonitorProfile()
|
||||
{
|
||||
implementation->findDefaultMonitorProfile();
|
||||
}
|
||||
|
||||
cmsHPROFILE rtengine::ICCStore::getDefaultMonitorProfile() const
|
||||
{
|
||||
return implementation->getDefaultMonitorProfile();
|
||||
}
|
||||
|
||||
Glib::ustring rtengine::ICCStore::getDefaultMonitorProfileName() const
|
||||
{
|
||||
return implementation->getDefaultMonitorProfileName();
|
||||
}
|
||||
|
||||
cmsHPROFILE rtengine::ICCStore::workingSpace(const Glib::ustring& name) const
|
||||
{
|
||||
return implementation->workingSpace(name);
|
||||
|
||||
Reference in New Issue
Block a user