X11 atom for display profile

Boudewijn Rempt boud at valdyas.org
Fri Jun 24 11:17:09 BST 2005


This was discussed on the openicc list and I want Krita to support it. 
Basically, there's an X11 atom (whatever that my be) that you use in some way 
that's not clear to me to get a chunk of data that we can feed to lcms. This 
would be a handy way to set the display profile by default.

The gdk code is like this:

static cmsHPROFILE *
get_screen_profile (GdkScreen *screen)
{
       Display *dpy;
       Atom icc_atom, type;
       int format;
       gulong nitems;
       gulong bytes_after;
       guchar *str;
       int result;
       cmsHPROFILE *profile;

       g_return_val_if_fail (screen != NULL, NULL);

       dpy = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (screen));
       icc_atom = gdk_x11_get_xatom_by_name_for_display gdk_screen_get_display 
(screen), "_ICC_PROFILE");

       result = XGetWindowProperty (dpy, GDK_WINDOW_XID 	
				    (gdk_screen_get_root_window (screen)),
                                    icc_atom, 0, G_MAXLONG,
                                    False, XA_CARDINAL, &type, &format, 
				    &nitems,
                                    &bytes_after, (guchar **)&str);

       if (nitems) {
               profile = cmsOpenProfileFromMem(str, nitems);
               XFree (str);
               return profile;
       } else {
               g_printerr("No profile, not correcting\n");
               return NULL;
       }
}

I can translate most of this without problems, I don't know what the right 
(Qt) way for getting the atom and the screen.

-- 
Boudewijn Rempt 
http://www.valdyas.org/fading/index.cgi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20050624/3c768720/attachment.sig>


More information about the kde-core-devel mailing list