Skip to content

Conversation

@Dannny1
Copy link

@Dannny1 Dannny1 commented Jan 1, 2026

This is just taken from git-db-usr@262b8a6
Since nobody has created PR from it before, i will just open one.

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
Copy link
Member

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>");

if(!hMonitor){ return;} //TODO log error
MONITORINFOEX monitorInfo;
monitorInfo.cbSize = sizeof(MONITORINFOEX);
if(!GetMonitorInfoW(hMonitor,(LPMONITORINFO) &monitorInfo)) { return;} //get monitor info , TODO log error
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

if(!hMonitor){ return;} //TODO log error
MONITORINFOEX monitorInfo;
monitorInfo.cbSize = sizeof(MONITORINFOEX);
if(!GetMonitorInfoW(hMonitor,(LPMONITORINFO) &monitorInfo)) { return;} //get monitor info , TODO log error
Copy link
Member

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.

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
Copy link
Member

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.

@TurboGit TurboGit added this to the 5.6 milestone Jan 2, 2026
@TurboGit TurboGit added scope: windows support windows related issues and PR bugfix pull request fixing a bug release notes: pending labels Jan 2, 2026
@Dannny1
Copy link
Author

Dannny1 commented Jan 3, 2026

Ok, it's updated.

Copy link
Member

@TurboGit TurboGit left a 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;}
Copy link
Member

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
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix pull request fixing a bug release notes: pending scope: windows support windows related issues and PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants