-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix color management issue on windows #20054
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
src/common/colorspaces.c
Outdated
| GdkWindow *window = gtk_widget_get_window(widget); | ||
| HWND hwnd = (HWND)gdk_win32_window_get_handle(window); // get window handle | ||
| HMONITOR hMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); // get monitor handle | ||
| if(!hMonitor){ return;} //TODO log error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we are at it, can you please add some log:
dt_print(DT_DEBUG_ALWAYS, "[win32 dt_colorspaces_set_display_profile] <ERROR MESS HERE>");
src/common/colorspaces.c
Outdated
| if(!hMonitor){ return;} //TODO log error | ||
| MONITORINFOEX monitorInfo; | ||
| monitorInfo.cbSize = sizeof(MONITORINFOEX); | ||
| if(!GetMonitorInfoW(hMonitor,(LPMONITORINFO) &monitorInfo)) { return;} //get monitor info , TODO log error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
src/common/colorspaces.c
Outdated
| if(!hMonitor){ return;} //TODO log error | ||
| MONITORINFOEX monitorInfo; | ||
| monitorInfo.cbSize = sizeof(MONITORINFOEX); | ||
| if(!GetMonitorInfoW(hMonitor,(LPMONITORINFO) &monitorInfo)) { return;} //get monitor info , TODO log error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: We need a space after coma.
src/common/colorspaces.c
Outdated
| MONITORINFOEX monitorInfo; | ||
| monitorInfo.cbSize = sizeof(MONITORINFOEX); | ||
| if(!GetMonitorInfoW(hMonitor,(LPMONITORINFO) &monitorInfo)) { return;} //get monitor info , TODO log error | ||
| HDC hdc = CreateIC(L"MONITOR",monitorInfo.szDevice,NULL,NULL); // get device-info context of the monitor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: We need a space after coma.
|
Ok, it's updated. |
TurboGit
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there :) TIA.
| GdkWindow *window = gtk_widget_get_window(widget); | ||
| HWND hwnd = (HWND)gdk_win32_window_get_handle(window); // get window handle | ||
| HMONITOR hMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); // get monitor handle | ||
| if(!hMonitor){ dt_print(DT_DEBUG_ALWAYS, "[win32 dt_colorspaces_set_display_profile] error getting monitor handle"); return;} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style: as I said { should be on its own line. Please try to follow current style.
if(!hMonitor)
{
dt_print(DT_DEBUG_ALWAYS, "[win32 dt_colorspaces_set_display_profile] error getting monitor handle");
return;
}
| if(!hMonitor){ dt_print(DT_DEBUG_ALWAYS, "[win32 dt_colorspaces_set_display_profile] error getting monitor handle"); return;} | ||
| MONITORINFOEX monitorInfo; | ||
| monitorInfo.cbSize = sizeof(MONITORINFOEX); | ||
| if(!GetMonitorInfoW(hMonitor, (LPMONITORINFO) &monitorInfo)) //get monitor info |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise, { should be under if.
This is just taken from git-db-usr@262b8a6
Since nobody has created PR from it before, i will just open one.