aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fiv-view.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/fiv-view.c b/fiv-view.c
index e0e42c0..c570f35 100644
--- a/fiv-view.c
+++ b/fiv-view.c
@@ -30,6 +30,11 @@
#ifdef GDK_WINDOWING_QUARTZ
#include <gdk/gdkquartz.h>
#endif // GDK_WINDOWING_QUARTZ
+#ifdef GDK_WINDOWING_WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <gdk/gdkwin32.h>
+#endif // GDK_WINDOWING_WIN32
GType
fiv_view_command_get_type(void)
@@ -448,6 +453,28 @@ reload_screen_cms_profile(FivView *self, GdkWindow *window)
{
g_clear_pointer(&self->screen_cms_profile, fiv_io_profile_free);
+#ifdef GDK_WINDOWING_WIN32
+ if (GDK_IS_WIN32_WINDOW(window)) {
+ HWND hwnd = GDK_WINDOW_HWND(window);
+ HDC hdc = GetDC(hwnd);
+ if (hdc) {
+ DWORD len = 0;
+ (void) GetICMProfile(hdc, &len, NULL);
+ gchar *path = g_new(gchar, len);
+ if (GetICMProfile(hdc, &len, path)) {
+ gchar *data = NULL;
+ gsize length = 0;
+ if (g_file_get_contents(path, &data, &length, NULL))
+ self->screen_cms_profile = fiv_io_profile_new(data, length);
+ g_free(data);
+ }
+ g_free(path);
+ ReleaseDC(hwnd, hdc);
+ }
+ goto out;
+ }
+#endif // GDK_WINDOWING_WIN32
+
GdkDisplay *display = gdk_window_get_display(window);
GdkMonitor *monitor = gdk_display_get_monitor_at_window(display, window);