diff --strip-trailing-cr -c -r Argyll_V1.0.0/doc/ArgyllDoc.html Argyll_V1.0.1/doc/ArgyllDoc.html *** Argyll_V1.0.0/doc/ArgyllDoc.html Mon Jun 30 23:21:32 2008 --- Argyll_V1.0.1/doc/ArgyllDoc.html Wed Jul 9 23:48:03 2008 *************** *** 11,19 ****

! Argyll CMS documentation index (V1.0.0)

! Date:   27th June 2008
Author: Graeme Gill

Introduction

--- 11,19 ----

! Argyll CMS documentation index (V1.0.1)

! Date:   1st July 2008
Author: Graeme Gill

Introduction

diff --strip-trailing-cr -c -r Argyll_V1.0.0/doc/ChangesSummary.html Argyll_V1.0.1/doc/ChangesSummary.html *** Argyll_V1.0.0/doc/ChangesSummary.html Mon Jun 30 23:21:32 2008 --- Argyll_V1.0.1/doc/ChangesSummary.html Wed Jul 9 23:48:03 2008 *************** *** 42,47 **** --- 42,49 ----
  • Installation archives now include a top directory, and gzip/tar format for OS X and Linux.
  • +
  • Added B2A table to input device LUT profiles by default.
    +
  • As usual, a more detailed description of all changes is in the log.txt file that accompanies the diff --strip-trailing-cr -c -r Argyll_V1.0.0/doc/dispcal.html Argyll_V1.0.1/doc/dispcal.html *** Argyll_V1.0.0/doc/dispcal.html Mon Jun 30 23:21:34 2008 --- Argyll_V1.0.1/doc/dispcal.html Wed Jul 9 23:48:04 2008 *************** *** 735,740 **** --- 735,747 ---- name needs to be specified, do so as an argument to the -o flag.

    + NOTE that on an X11 system, if + the environment variable ARGYLL_IGNORE_XRANDR1_2 + is set (ie. set it to "yes"), then the presence of the XRandR 1.2 + extension will be ignored, and other extensions such as Xinerama and + XF86VidMode extension will be used. This may be a way to work around + buggy XRandR 1.2 implementations.
    +


    The adjustment of the display controls (brightness, contrast, R, G diff --strip-trailing-cr -c -r Argyll_V1.0.0/doc/dispread.html Argyll_V1.0.1/doc/dispread.html *** Argyll_V1.0.0/doc/dispread.html Mon Jun 30 23:21:34 2008 --- Argyll_V1.0.1/doc/dispread.html Wed Jul 9 23:48:04 2008 *************** *** 306,311 **** --- 306,318 ---- file. dispread will add the .ti1 and .ti3 extensions automatically.

    + NOTE that on an X11 system, if + the environment variable ARGYLL_IGNORE_XRANDR1_2 + is set (ie. set it to "yes"), then the presence of the XRandR 1.2 + extension will be ignored, and other extensions such as Xinerama and + XF86VidMode extension will be used. This may be a way to work around + buggy XRandR 1.2 implementations.
    +


    If a large number of patches is being read, the screensaver on many systems can interfere with the operation of dispread. It is therefore diff --strip-trailing-cr -c -r Argyll_V1.0.0/doc/dispwin.html Argyll_V1.0.1/doc/dispwin.html *** Argyll_V1.0.0/doc/dispwin.html Mon Jun 30 23:21:34 2008 --- Argyll_V1.0.1/doc/dispwin.html Wed Jul 9 23:48:04 2008 *************** *** 110,118 **** href="#D">-D                   [X11 ! only] Run in daemon loader mode for given X11 server
     
    -D                   [X11 ! only] Run in daemon loader mode for given X11 server
    !
     -E [level]           ! Print debug diagnostics to stderr
     

    + The -E flag causes diagnostics to be printed to + stdout. A level can + be set between 1 .. 9, that may give progressively more verbose + information. This can be useful in + tracking + down why an operation fails.
    +
    The final optional parameter on the command line is the name of an ICC profile that contains a Video LUT vcgt tag, or an Argyll
    + NOTE that on an X11 system, if + the environment variable ARGYLL_IGNORE_XRANDR1_2 + is set (ie. set it to "yes"), then the presence of the XRandR 1.2 + extension will be ignored, and other extensions such as Xinerama and + XF86VidMode extension will be used. This may be a way to work around + buggy XRandR 1.2 implementations.
    +



    diff --strip-trailing-cr -c -r Argyll_V1.0.0/h/config.h Argyll_V1.0.1/h/config.h *** Argyll_V1.0.0/h/config.h Mon Jun 30 23:21:31 2008 --- Argyll_V1.0.1/h/config.h Wed Jul 9 23:48:01 2008 *************** *** 10,17 **** /* minor number = 8 bits */ /* major number = 8 bits */ ! #define ARGYLL_VERSION 0x01000 ! #define ARGYLL_VERSION_STR "1.0.0" /* Maximum file path length */ #define MAXNAMEL 512 --- 10,17 ---- /* minor number = 8 bits */ /* major number = 8 bits */ ! #define ARGYLL_VERSION 0x01001 ! #define ARGYLL_VERSION_STR "1.0.1" /* Maximum file path length */ #define MAXNAMEL 512 diff --strip-trailing-cr -c -r Argyll_V1.0.0/jcnf/jcnf.c Argyll_V1.0.1/jcnf/jcnf.c *** Argyll_V1.0.0/jcnf/jcnf.c Mon Jun 30 23:21:28 2008 --- Argyll_V1.0.1/jcnf/jcnf.c Wed Jul 9 23:47:58 2008 *************** *** 804,810 **** jcnf *p ) { FILE *fp; /* For temporary file */ ! char tname[100]; yajl_gen_config conf = { 1, " " }; yajl_gen g; yajl_status stat; --- 804,810 ---- jcnf *p ) { FILE *fp; /* For temporary file */ ! char *tname = NULL; yajl_gen_config conf = { 1, " " }; yajl_gen g; yajl_status stat; *************** *** 823,843 **** { int fh; /* Create temporary file, open it and lock it LOCK_EX */ ! strcpy(tname, "/tmp/jcnf-XXXXXX"); ! if ((fh = mkstemp(tname)) == -1) return jc_write_open; ! if (fchmod(fh, 0644) != 0) return jc_write_open; ! if ((fp = fdopen(fh, "w")) == NULL) return jc_write_open; } #else /* Open a temporary file in the same directory to write to */ if (tmpnam(tname) == NULL) { return jc_write_open; } if ((fp = fopen(tname, "w")) == NULL) { return jc_write_open; } #endif --- 823,858 ---- { int fh; + if ((tname = malloc(strlen(p->fname) + 8)) == NULL) + return jc_malloc; + /* Create temporary file, open it and lock it LOCK_EX */ ! strcpy(tname, p->fname); ! strcat(tname,"-XXXXXX"); ! if ((fh = mkstemp(tname)) == -1) { ! free(tname); return jc_write_open; ! } ! if (fchmod(fh, 0644) != 0) { ! free(tname); return jc_write_open; ! } ! if ((fp = fdopen(fh, "w")) == NULL) { ! free(tname); return jc_write_open; + } } #else /* Open a temporary file in the same directory to write to */ + if ((tname = malloc(strlen(p->fname) + 8)) == NULL) + return jc_malloc; + if (tmpnam(tname) == NULL) { + free(tname); return jc_write_open; } if ((fp = fopen(tname, "w")) == NULL) { + free(tname); return jc_write_open; } #endif *************** *** 934,941 **** yajl_gen_string(g, (char *)p->keys[i]->data, p->keys[i]->dataSize-1); break; ! default: return jc_unknown_key_type; } if (p->keys[i]->comment != NULL) { --- 949,958 ---- yajl_gen_string(g, (char *)p->keys[i]->data, p->keys[i]->dataSize-1); break; ! default: { ! free(tname); return jc_unknown_key_type; + } } if (p->keys[i]->comment != NULL) { *************** *** 969,976 **** yajl_gen_clear(g); } yajl_gen_free(g); ! if (fflush(fp) != 0) return jc_write_close; #ifdef NT /* MSWindows rename won't replace existing or open files. */ --- 986,995 ---- yajl_gen_clear(g); } yajl_gen_free(g); ! if (fflush(fp) != 0) { ! free(tname); return jc_write_close; + } #ifdef NT /* MSWindows rename won't replace existing or open files. */ *************** *** 989,1007 **** //printf("~1 about to rename '%s' to '%s'\n",tname,p->fname); /* Now atomicaly rename the file to replace the file we read */ if (rename(tname, p->fname) != 0) { return jc_write_close; } //printf("~1 closing files\n"); /* Close our files and release the locks */ ! if (fp != NULL && fclose(fp) != 0) return jc_write_close; ! if (p->fp != NULL && fclose(p->fp) != 0) return jc_write_close; p->fp = NULL; p->locked = 0; p->modify = 0; return jc_ok; } --- 1008,1032 ---- //printf("~1 about to rename '%s' to '%s'\n",tname,p->fname); /* Now atomicaly rename the file to replace the file we read */ if (rename(tname, p->fname) != 0) { + free(tname); return jc_write_close; } //printf("~1 closing files\n"); /* Close our files and release the locks */ ! if (fp != NULL && fclose(fp) != 0) { ! free(tname); return jc_write_close; ! } ! if (p->fp != NULL && fclose(p->fp) != 0) { ! free(tname); return jc_write_close; + } p->fp = NULL; p->locked = 0; p->modify = 0; + free(tname); return jc_ok; } diff --strip-trailing-cr -c -r Argyll_V1.0.0/libusb/45-Argyll.rules Argyll_V1.0.1/libusb/45-Argyll.rules *** Argyll_V1.0.0/libusb/45-Argyll.rules Mon Jun 30 23:21:08 2008 --- Argyll_V1.0.1/libusb/45-Argyll.rules Wed Jul 9 23:47:36 2008 *************** *** 27,36 **** SYSFS{idVendor}=="0971", SYSFS{idProduct}=="2000", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="666" # Colorimtre HCFR ! SYSFS{idVendor}=="04DB", SYSFS{idProduct}=="005B", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="666" # Spyder 2 ! SYSFS{idVendor}=="085C", SYSFS{idProduct}=="0200", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="666" # Huey SYSFS{idVendor}=="0971", SYSFS{idProduct}=="2005", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="666" --- 27,36 ---- SYSFS{idVendor}=="0971", SYSFS{idProduct}=="2000", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="666" # Colorimtre HCFR ! SYSFS{idVendor}=="04db", SYSFS{idProduct}=="005b", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="666" # Spyder 2 ! SYSFS{idVendor}=="085c", SYSFS{idProduct}=="0200", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="666" # Huey SYSFS{idVendor}=="0971", SYSFS{idProduct}=="2005", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="666" diff --strip-trailing-cr -c -r Argyll_V1.0.0/libusb/55-Argyll.rules Argyll_V1.0.1/libusb/55-Argyll.rules *** Argyll_V1.0.0/libusb/55-Argyll.rules Mon Jun 30 23:21:08 2008 --- Argyll_V1.0.1/libusb/55-Argyll.rules Wed Jul 9 23:47:36 2008 *************** *** 26,35 **** SYSFS{idVendor}=="0971", SYSFS{idProduct}=="2000", MODE="666" # Colorimtre HCFR ! SYSFS{idVendor}=="04DB", SYSFS{idProduct}=="005B", MODE="666" # Spyder 2 ! SYSFS{idVendor}=="085C", SYSFS{idProduct}=="0200", MODE="666" # Huey SYSFS{idVendor}=="0971", SYSFS{idProduct}=="2005", MODE="666" --- 26,35 ---- SYSFS{idVendor}=="0971", SYSFS{idProduct}=="2000", MODE="666" # Colorimtre HCFR ! SYSFS{idVendor}=="04db", SYSFS{idProduct}=="005b", MODE="666" # Spyder 2 ! SYSFS{idVendor}=="085c", SYSFS{idProduct}=="0200", MODE="666" # Huey SYSFS{idVendor}=="0971", SYSFS{idProduct}=="2005", MODE="666" diff --strip-trailing-cr -c -r Argyll_V1.0.0/log.txt Argyll_V1.0.1/log.txt *** Argyll_V1.0.0/log.txt Mon Jun 30 23:20:55 2008 --- Argyll_V1.0.1/log.txt Wed Jul 9 23:47:22 2008 *************** *** 3,9 **** ===================== ! Version 1.00 changes -------------------- * Changed input device profile creation to create B2A table --- 3,41 ---- ===================== ! Version 1.0.1 bug fix release (still open) ! ----------------------------- ! ! * Changed XRandR code to fall back to other extensions ! if it fails simple VideoLUT access tests. ! ! * Fixed problem with locating displays on MSWindows with ! some particular configurations. ! ! * Fixed bug introduced into cam02.c that ignored ! enumerated viewing condition. ! ! * Changed udev USB matches to lower case, since ! apparently udev does a text match rather than matching ! the integers... ! ! * Fixed malloc size bug in profile/logo2cgats.c ! (thanks to Steven Greaves). ! ! * Add environment variable "ARGYLL_IGNORE_XRANDR1_2" to ! cause XRandR 1.2 to be ignored on X11 systems ! that have buggy XRandR 1.2 implementation. ! ! * Fix dispwin so that the lack of an EDID_DATA atome is ! not a fatal error. ! ! * Fixed jcnf so that the temporary file is in the same directory ! as the file it will be renamed to. ! ! * Added debug option to dispwin/ucmm to help with diagnosis of ! locating displays. ! ! Version 1.0.0 changes -------------------- * Changed input device profile creation to create B2A table diff --strip-trailing-cr -c -r Argyll_V1.0.0/makeall.sh Argyll_V1.0.1/makeall.sh *** Argyll_V1.0.0/makeall.sh Mon Jun 30 23:20:55 2008 --- Argyll_V1.0.1/makeall.sh Wed Jul 9 23:47:23 2008 *************** *** 3,9 **** if [ X$OS != "XWindows_NT" ] ; then # Fixup issues with the .zip format ! chmod +x *.ksh chmod +x tiff/configure chmod +x libusb/configure fi --- 3,9 ---- if [ X$OS != "XWindows_NT" ] ; then # Fixup issues with the .zip format ! chmod +x *.sh chmod +x tiff/configure chmod +x libusb/configure fi diff --strip-trailing-cr -c -r Argyll_V1.0.0/makeinstall.sh Argyll_V1.0.1/makeinstall.sh *** Argyll_V1.0.0/makeinstall.sh Mon Jun 30 23:20:55 2008 --- Argyll_V1.0.1/makeinstall.sh Wed Jul 9 23:47:23 2008 *************** *** 4,10 **** if [ X$OS != "XWindows_NT" ] ; then # Fixup issues with the .zip format ! chmod +x *.ksh chmod +x tiff/configure chmod +x libusb/configure fi --- 4,10 ---- if [ X$OS != "XWindows_NT" ] ; then # Fixup issues with the .zip format ! chmod +x *.sh chmod +x tiff/configure chmod +x libusb/configure fi diff --strip-trailing-cr -c -r Argyll_V1.0.0/makepackagebin.sh Argyll_V1.0.1/makepackagebin.sh *** Argyll_V1.0.0/makepackagebin.sh Mon Jun 30 23:20:55 2008 --- Argyll_V1.0.1/makepackagebin.sh Wed Jul 9 23:47:23 2008 *************** *** 13,19 **** # # OS X i386 10.4 [bash] darwin8.0 i386-apple-darwin8.0 i386 # ! # OS X i386 10.5 [bash] darwin9.0 i386-apple-darwin8.0 i386 # # Linux RH 4.0 [bash] linux-gnu i686-redhat-linux-gnu i686 # --- 13,19 ---- # # OS X i386 10.4 [bash] darwin8.0 i386-apple-darwin8.0 i386 # ! # OS X i386 10.5 [bash] darwin9.0 i386-apple-darwin9.0 i386 # # Linux RH 4.0 [bash] linux-gnu i686-redhat-linux-gnu i686 # *************** *** 22,28 **** # Linux Fedora 7.1 64 bit [bash] linux-gnu x86_64-redhat-linux-gnu x86_64 # ! VERSION=1.0.0 TOPDIR=Argyll_V$VERSION --- 22,28 ---- # Linux Fedora 7.1 64 bit [bash] linux-gnu x86_64-redhat-linux-gnu x86_64 # ! VERSION=1.0.1 TOPDIR=Argyll_V$VERSION *************** *** 36,41 **** --- 36,42 ---- rm -f bin/*.exe bin/*.dll rm -f ref/*.sp ref/*.cht ref/*.ti2 + # Ack! - should abort if jam failes! jam -q -fJambase -j${NUMBER_OF_PROCESSORS:-2} -sBUILTIN_TIFF=true install # Maybe we could get Jam to do the following ? *************** *** 62,68 **** unset USBDIR USETAR=true else if [ X$OSTYPE = "Xdarwin9.0" ] ; then ! if [ X$MACHTYPE = "Xi386-apple-darwin8.0" ] ; then echo "We're on OSX 10.5 i386!" PACKAGE=Argyll_V${VERSION}_osx10.5_i86_bin.tgz fi --- 63,69 ---- unset USBDIR USETAR=true else if [ X$OSTYPE = "Xdarwin9.0" ] ; then ! if [ X$MACHTYPE = "Xi386-apple-darwin9.0" ] ; then echo "We're on OSX 10.5 i386!" PACKAGE=Argyll_V${VERSION}_osx10.5_i86_bin.tgz fi diff --strip-trailing-cr -c -r Argyll_V1.0.0/profile/logo2cgats.c Argyll_V1.0.1/profile/logo2cgats.c *** Argyll_V1.0.0/profile/logo2cgats.c Mon Jun 30 23:21:25 2008 --- Argyll_V1.0.1/profile/logo2cgats.c Wed Jul 9 23:47:55 2008 *************** *** 516,522 **** cgats_set_elem *setel; /* Array of set value elements */ if ((setel = (cgats_set_elem *)malloc( ! sizeof(cgats_set_elem) * (1 + (isrgb ? 3 : 4) + 3 + (spec != NULL ? specnum : 0)))) == NULL) error("Malloc failed!"); /* Write out the patch info to the output CGATS file */ --- 516,522 ---- cgats_set_elem *setel; /* Array of set value elements */ if ((setel = (cgats_set_elem *)malloc( ! sizeof(cgats_set_elem) * ocg->t[0].nfields)) == NULL) error("Malloc failed!"); /* Write out the patch info to the output CGATS file */ diff --strip-trailing-cr -c -r Argyll_V1.0.0/profile/profcheck.c Argyll_V1.0.1/profile/profcheck.c *** Argyll_V1.0.0/profile/profcheck.c Mon Jun 30 23:21:25 2008 --- Argyll_V1.0.1/profile/profcheck.c Wed Jul 9 23:47:55 2008 *************** *** 744,759 **** if (verb) { if (devspace == icSigCmykData) { ! printf("[%f] %f %f %f %f -> %f %f %f should be %f %f %f\n", cie2k ? icmCIE2K(tpat[i].v, out) : cie94 ? icmCIE94(tpat[i].v, out) : icmLabDE(tpat[i].v, out), tpat[i].p[0],tpat[i].p[1],tpat[i].p[2],tpat[i].p[3], out[0],out[1],out[2], tpat[i].v[0],tpat[i].v[1],tpat[i].v[2]); } else { /* Assume RGB/CMY */ ! printf("[%f] %f %f %f -> %f %f %f should be %f %f %f\n", cie2k ? icmCIE2K(tpat[i].v, out) : cie94 ? icmCIE94(tpat[i].v, out) : icmLabDE(tpat[i].v, out), tpat[i].p[0],tpat[i].p[1],tpat[i].p[2], out[0],out[1],out[2], tpat[i].v[0],tpat[i].v[1],tpat[i].v[2]); --- 744,761 ---- if (verb) { if (devspace == icSigCmykData) { ! printf("[%f] %s: %f %f %f %f -> %f %f %f should be %f %f %f\n", cie2k ? icmCIE2K(tpat[i].v, out) : cie94 ? icmCIE94(tpat[i].v, out) : icmLabDE(tpat[i].v, out), + tpat[i].sid, tpat[i].p[0],tpat[i].p[1],tpat[i].p[2],tpat[i].p[3], out[0],out[1],out[2], tpat[i].v[0],tpat[i].v[1],tpat[i].v[2]); } else { /* Assume RGB/CMY */ ! printf("[%f] %s: %f %f %f -> %f %f %f should be %f %f %f\n", cie2k ? icmCIE2K(tpat[i].v, out) : cie94 ? icmCIE94(tpat[i].v, out) : icmLabDE(tpat[i].v, out), + tpat[i].sid, tpat[i].p[0],tpat[i].p[1],tpat[i].p[2], out[0],out[1],out[2], tpat[i].v[0],tpat[i].v[1],tpat[i].v[2]); diff --strip-trailing-cr -c -r Argyll_V1.0.0/spectro/Jamfile Argyll_V1.0.1/spectro/Jamfile *** Argyll_V1.0.0/spectro/Jamfile Mon Jun 30 23:21:19 2008 --- Argyll_V1.0.1/spectro/Jamfile Wed Jul 9 23:47:49 2008 *************** *** 1,7 **** ! #PREF_CCFLAGS += $(CCOPTFLAG) ; # Turn optimisation on ! PREF_CCFLAGS += $(CCDEBUGFLAG) ; # Debugging flags PREF_LINKFLAGS += $(LINKDEBUGFLAG) ; # Setup the right hardware access libraries --- 1,7 ---- ! PREF_CCFLAGS += $(CCOPTFLAG) ; # Turn optimisation on ! #PREF_CCFLAGS += $(CCDEBUGFLAG) ; # Debugging flags PREF_LINKFLAGS += $(LINKDEBUGFLAG) ; # Setup the right hardware access libraries diff --strip-trailing-cr -c -r Argyll_V1.0.0/spectro/dispcal.c Argyll_V1.0.1/spectro/dispcal.c *** Argyll_V1.0.0/spectro/dispcal.c Mon Jun 30 23:21:19 2008 --- Argyll_V1.0.1/spectro/dispcal.c Wed Jul 9 23:47:49 2008 *************** *** 1443,1448 **** --- 1443,1449 ---- debug = atoi(na); fa = nfa; } + callback_ddebug = 1; /* dispwin global */ } else if (argv[fa][1] == 'k') { fa = nfa; diff --strip-trailing-cr -c -r Argyll_V1.0.0/spectro/dispread.c Argyll_V1.0.1/spectro/dispread.c *** Argyll_V1.0.0/spectro/dispread.c Mon Jun 30 23:21:19 2008 --- Argyll_V1.0.1/spectro/dispread.c Wed Jul 9 23:47:49 2008 *************** *** 343,348 **** --- 343,349 ---- debug = atoi(na); fa = nfa; } + callback_ddebug = 1; /* dispwin global */ } else if (argv[fa][1] == 'N') { nocal = 1; diff --strip-trailing-cr -c -r Argyll_V1.0.0/spectro/dispsup.c Argyll_V1.0.1/spectro/dispsup.c *** Argyll_V1.0.0/spectro/dispsup.c Mon Jun 30 23:21:19 2008 --- Argyll_V1.0.1/spectro/dispsup.c Wed Jul 9 23:47:49 2008 *************** *** 192,198 **** if (dwi->dw == NULL) { if ((dw = new_dispwin(dwi->disp, dwi->patsize, dwi->patsize, dwi->ho, dwi->vo, 0, 0, dwi->blackbg, ! dwi->override)) == NULL) { DBG(("inst_handle_calibrate failed to create test window 0x%x\n",inst_other_error)) return inst_other_error; } --- 192,198 ---- if (dwi->dw == NULL) { if ((dw = new_dispwin(dwi->disp, dwi->patsize, dwi->patsize, dwi->ho, dwi->vo, 0, 0, dwi->blackbg, ! dwi->override, p->debug)) == NULL) { DBG(("inst_handle_calibrate failed to create test window 0x%x\n",inst_other_error)) return inst_other_error; } *************** *** 218,224 **** if (dwi->dw == NULL) { if ((dw = new_dispwin(dwi->disp, dwi->patsize, dwi->patsize, dwi->ho, dwi->vo, 0, 0, dwi->blackbg, ! dwi->override)) == NULL) { DBG(("inst_handle_calibrate failed to create test window 0x%x\n",inst_other_error)) return inst_other_error; } --- 218,224 ---- if (dwi->dw == NULL) { if ((dw = new_dispwin(dwi->disp, dwi->patsize, dwi->patsize, dwi->ho, dwi->vo, 0, 0, dwi->blackbg, ! dwi->override, p->debug)) == NULL) { DBG(("inst_handle_calibrate failed to create test window 0x%x\n",inst_other_error)) return inst_other_error; } *************** *** 1316,1322 **** /* Open display window */ if ((p->dw = new_dispwin(disp, patsize, patsize, ho, vo, 0, donat, blackbg, ! override)) == NULL) { DBG(("Failed to creat a display window \n")) p->del(p); if (errc != NULL) *errc = 3; --- 1316,1322 ---- /* Open display window */ if ((p->dw = new_dispwin(disp, patsize, patsize, ho, vo, 0, donat, blackbg, ! override, debug)) == NULL) { DBG(("Failed to creat a display window \n")) p->del(p); if (errc != NULL) *errc = 3; diff --strip-trailing-cr -c -r Argyll_V1.0.0/spectro/dispwin.c Argyll_V1.0.1/spectro/dispwin.c *** Argyll_V1.0.0/spectro/dispwin.c Mon Jun 30 23:21:21 2008 --- Argyll_V1.0.1/spectro/dispwin.c Wed Jul 9 23:47:51 2008 *************** *** 69,85 **** //#define STANDALONE_TEST #ifdef DEBUG ! # define errout stderr # define debug(xx) fprintf(errout, xx ) # define debug2(xx) fprintf xx #else ! # define debug(xx) # define debug2(xx) #endif /* ----------------------------------------------- */ /* Dealing with locating displays */ #ifdef NT #define sleep(secs) Sleep((secs) * 1000) --- 69,96 ---- //#define STANDALONE_TEST #ifdef DEBUG ! #define errout stderr # define debug(xx) fprintf(errout, xx ) # define debug2(xx) fprintf xx + # define debugr(xx) fprintf(errout, xx ) + # define debugr2(xx) fprintf xx + # define debugrr(xx) fprintf(errout, xx ) + # define debugrr2(xx) fprintf xx #else ! #define errout stderr ! # define debug(xx) # define debug2(xx) + # define debugr(xx) if (p->ddebug) fprintf(errout, xx ) + # define debugr2(xx) if (p->ddebug) fprintf xx + # define debugrr(xx) if (callback_ddebug) fprintf(errout, xx ) + # define debugrr2(xx) if (callback_ddebug) fprintf xx #endif /* ----------------------------------------------- */ /* Dealing with locating displays */ + int callback_ddebug = 0; /* Diagnostic global for get_displays() and get_a_display() */ + #ifdef NT #define sleep(secs) Sleep((secs) * 1000) *************** *** 95,104 **** MONITORINFOEX pmi; int ndisps = 0; /* Add the display to the list */ if (disps == NULL) { if ((disps = (disppath **)calloc(sizeof(disppath *), 1 + 1)) == NULL) { ! debug("get_displays failed on malloc\n"); return FALSE; } } else { --- 106,117 ---- MONITORINFOEX pmi; int ndisps = 0; + debugrr2((errout, "MonitorEnumProc() called with hMonitor = 0x%x\n",hMonitor)); + /* Add the display to the list */ if (disps == NULL) { if ((disps = (disppath **)calloc(sizeof(disppath *), 1 + 1)) == NULL) { ! debugrr("get_displays failed on malloc\n"); return FALSE; } } else { *************** *** 107,131 **** ; if ((disps = (disppath **)realloc(disps, sizeof(disppath *) * (ndisps + 2))) == NULL) { ! debug("get_displays failed on malloc\n"); return FALSE; } disps[ndisps+1] = NULL; /* End marker */ } if ((disps[ndisps] = calloc(sizeof(disppath),1)) == NULL) { ! debug("get_displays failed on malloc\n"); return FALSE; } pmi.cbSize = sizeof(MONITORINFOEX); if (GetMonitorInfo(hMonitor, (MONITORINFO *)&pmi) == 0) { ! debug("get_displays failed GetMonitorInfo\n"); return FALSE; } if ((disps[ndisps]->name = strdup(pmi.szDevice)) == NULL) { ! debug("malloc failed\n"); return FALSE; } disps[ndisps]->prim = (pmi.dwFlags & MONITORINFOF_PRIMARY) ? 1 : 0; --- 120,144 ---- ; if ((disps = (disppath **)realloc(disps, sizeof(disppath *) * (ndisps + 2))) == NULL) { ! debugrr("get_displays failed on malloc\n"); return FALSE; } disps[ndisps+1] = NULL; /* End marker */ } if ((disps[ndisps] = calloc(sizeof(disppath),1)) == NULL) { ! debugrr("get_displays failed on malloc\n"); return FALSE; } pmi.cbSize = sizeof(MONITORINFOEX); if (GetMonitorInfo(hMonitor, (MONITORINFO *)&pmi) == 0) { ! debugrr("get_displays failed GetMonitorInfo\n"); return FALSE; } if ((disps[ndisps]->name = strdup(pmi.szDevice)) == NULL) { ! debugrr("malloc failed\n"); return FALSE; } disps[ndisps]->prim = (pmi.dwFlags & MONITORINFOF_PRIMARY) ? 1 : 0; *************** *** 137,142 **** --- 150,157 ---- disps[ndisps]->description = NULL; + debugrr2((errout, "MonitorEnumProc() set initial monitor info: %d,%d %d,%d name '%s'\n",disps[ndisps]->sx,disps[ndisps]->sy,disps[ndisps]->sw,disps[ndisps]->sh, disps[ndisps]->name)); + *pdisps = disps; return TRUE; } *************** *** 218,225 **** setup_dyn_calls(); if (EnumDisplayMonitors(NULL, NULL, MonitorEnumProc, (LPARAM)&disps) == 0) { free_disppaths(disps); - debug("EnumDisplayMonitors failed\n"); return NULL; } --- 233,240 ---- setup_dyn_calls(); if (EnumDisplayMonitors(NULL, NULL, MonitorEnumProc, (LPARAM)&disps) == 0) { + debugrr("EnumDisplayMonitors failed\n"); free_disppaths(disps); return NULL; } *************** *** 230,270 **** dd.cb = sizeof(dd); /* Get monitor information */ ! for (j = 0; ; j++) { if ((*pEnumDisplayDevices)(disps[i]->name, j, &dd, 0) == 0) { ! if (j == 0) { ! free_disppaths(disps); ! debug2((errout,"EnumDisplayDevices failed on '%s'\n",disps[i]->name)); ! return NULL; ! } break; } ! #ifdef NEVER ! printf("Mon %d, name '%s'\n",j,dd.DeviceName); ! printf("Mon %d, string '%s'\n",j,dd.DeviceString); ! printf("Mon %d, flags 0x%x\n",j,dd.StateFlags); ! printf("Mon %d, id '%s'\n",j,dd.DeviceID); ! printf("Mon %d, key '%s'\n",j,dd.DeviceKey); ! #endif if (j == 0) { strcpy(disps[i]->monname, dd.DeviceName); strcpy(disps[i]->monid, dd.DeviceID); } } sprintf(buf,"%s, at %d, %d, width %d, height %d%s",disps[i]->name+4, disps[i]->sx, disps[i]->sy, disps[i]->sw, disps[i]->sh, disps[i]->prim ? " (Primary Display)" : ""); if ((disps[i]->description = strdup(buf)) == NULL) { ! debug("get_displays failed on malloc\n"); free_disppaths(disps); return NULL; } /* Note that calling EnumDisplayDevices(NULL, j, ..) for the adapter can return other */ ! /* intformation, such as the graphics card name, and additional state flags. */ /* EnumDisplaySettings() can also be called to get information such as display depth etc. */ } --- 245,289 ---- dd.cb = sizeof(dd); + debugrr2((errout, "get_displays about to get monitor information for %d\n",i)); /* Get monitor information */ ! for (j = 0; ;j++) { if ((*pEnumDisplayDevices)(disps[i]->name, j, &dd, 0) == 0) { ! debugrr2((errout,"EnumDisplayDevices failed on '%s' Mon = %d\n",disps[i]->name,j)); break; } ! if (callback_ddebug) { ! fprintf(errout,"Mon %d, name '%s'\n",j,dd.DeviceName); ! fprintf(errout,"Mon %d, string '%s'\n",j,dd.DeviceString); ! fprintf(errout,"Mon %d, flags 0x%x\n",j,dd.StateFlags); ! fprintf(errout,"Mon %d, id '%s'\n",j,dd.DeviceID); ! fprintf(errout,"Mon %d, key '%s'\n",j,dd.DeviceKey); ! } if (j == 0) { strcpy(disps[i]->monname, dd.DeviceName); strcpy(disps[i]->monid, dd.DeviceID); } } + if (j == 0) { /* Hmm. Ignore this display */ + del_disppath(disps, i); + i--; + continue; + } sprintf(buf,"%s, at %d, %d, width %d, height %d%s",disps[i]->name+4, disps[i]->sx, disps[i]->sy, disps[i]->sw, disps[i]->sh, disps[i]->prim ? " (Primary Display)" : ""); if ((disps[i]->description = strdup(buf)) == NULL) { ! debugrr("get_displays failed on malloc\n"); free_disppaths(disps); return NULL; } + debugrr2((errout, "get_displays added description '%s' to display %d\n",disps[i]->description,i)); + /* Note that calling EnumDisplayDevices(NULL, j, ..) for the adapter can return other */ ! /* information, such as the graphics card name, and additional state flags. */ /* EnumDisplaySettings() can also be called to get information such as display depth etc. */ } *************** *** 295,325 **** CGDirectDisplayID *dids; /* Array of display IDs */ if ((dstat = CGGetActiveDisplayList(0, NULL, &dcount)) != kCGErrorSuccess || dcount < 1) { ! debug("CGGetActiveDisplayList #1 returned error\n"); return NULL; } if ((dids = (CGDirectDisplayID *)malloc(dcount * sizeof(CGDirectDisplayID))) == NULL) { ! debug("malloc of CGDirectDisplayID's failed\n"); return NULL; } if ((dstat = CGGetActiveDisplayList(dcount, dids, &dcount)) != kCGErrorSuccess) { ! debug("CGGetActiveDisplayList #2 returned error\n"); free(dids); return NULL; } /* Found dcount displays */ ! debug2((errout,"Found %d screens\n",dcount)); /* Allocate our list */ if ((disps = (disppath **)calloc(sizeof(disppath *), dcount + 1)) == NULL) { ! debug("get_displays failed on malloc\n"); free(dids); return NULL; } for (i = 0; i < dcount; i++) { if ((disps[i] = calloc(sizeof(disppath), 1)) == NULL) { ! debug("get_displays failed on malloc\n"); free_disppaths(disps); free(dids); return NULL; --- 314,344 ---- CGDirectDisplayID *dids; /* Array of display IDs */ if ((dstat = CGGetActiveDisplayList(0, NULL, &dcount)) != kCGErrorSuccess || dcount < 1) { ! debugrr("CGGetActiveDisplayList #1 returned error\n"); return NULL; } if ((dids = (CGDirectDisplayID *)malloc(dcount * sizeof(CGDirectDisplayID))) == NULL) { ! debugrr("malloc of CGDirectDisplayID's failed\n"); return NULL; } if ((dstat = CGGetActiveDisplayList(dcount, dids, &dcount)) != kCGErrorSuccess) { ! debugrr("CGGetActiveDisplayList #2 returned error\n"); free(dids); return NULL; } /* Found dcount displays */ ! debugrr2((errout,"Found %d screens\n",dcount)); /* Allocate our list */ if ((disps = (disppath **)calloc(sizeof(disppath *), dcount + 1)) == NULL) { ! debugrr("get_displays failed on malloc\n"); free(dids); return NULL; } for (i = 0; i < dcount; i++) { if ((disps[i] = calloc(sizeof(disppath), 1)) == NULL) { ! debugrr("get_displays failed on malloc\n"); free_disppaths(disps); free(dids); return NULL; *************** *** 344,350 **** /* Try and get some information about the display */ if ((dport = CGDisplayIOServicePort(dids[i])) == MACH_PORT_NULL) { ! debug("CGDisplayIOServicePort returned error\n"); free_disppaths(disps); free(dids); return NULL; --- 363,369 ---- /* Try and get some information about the display */ if ((dport = CGDisplayIOServicePort(dids[i])) == MACH_PORT_NULL) { ! debugrr("CGDisplayIOServicePort returned error\n"); free_disppaths(disps); free(dids); return NULL; *************** *** 354,360 **** { io_name_t name; if (IORegistryEntryGetName(dport, name) != KERN_SUCCESS) { ! debug("IORegistryEntryGetName returned error\n"); free_disppaths(disps); free(dids); return NULL; --- 373,379 ---- { io_name_t name; if (IORegistryEntryGetName(dport, name) != KERN_SUCCESS) { ! debugrr("IORegistryEntryGetName returned error\n"); free_disppaths(disps); free(dids); return NULL; *************** *** 363,375 **** } #endif if ((ddr = IODisplayCreateInfoDictionary(dport, 0)) == NULL) { ! debug("IODisplayCreateInfoDictionary returned NULL\n"); free_disppaths(disps); free(dids); return NULL; } if ((pndr = CFDictionaryGetValue(ddr, CFSTR(kDisplayProductName))) == NULL) { ! debug("CFDictionaryGetValue returned NULL\n"); CFRelease(ddr); free_disppaths(disps); free(dids); --- 382,394 ---- } #endif if ((ddr = IODisplayCreateInfoDictionary(dport, 0)) == NULL) { ! debugrr("IODisplayCreateInfoDictionary returned NULL\n"); free_disppaths(disps); free(dids); return NULL; } if ((pndr = CFDictionaryGetValue(ddr, CFSTR(kDisplayProductName))) == NULL) { ! debugrr("CFDictionaryGetValue returned NULL\n"); CFRelease(ddr); free_disppaths(disps); free(dids); *************** *** 387,393 **** free(keys); if (values != NULL) free(values); ! debug("malloc failed\n"); CFRelease(ddr); free_disppaths(disps); free(dids); --- 406,412 ---- free(keys); if (values != NULL) free(values); ! debugrr("malloc failed\n"); CFRelease(ddr); free_disppaths(disps); free(dids); *************** *** 430,436 **** if ((disps[i]->name = strdup(dp)) == NULL || (disps[i]->description = strdup(buf)) == NULL) { ! debug("get_displays failed on malloc\n"); free_disppaths(disps); free(dids); return NULL; --- 449,455 ---- if ((disps[i]->name = strdup(dp)) == NULL || (disps[i]->description = strdup(buf)) == NULL) { ! debugrr("get_displays failed on malloc\n"); free_disppaths(disps); free(dids); return NULL; *************** *** 478,495 **** strcpy(dnbuf,":0.0"); if ((mydisplay = XOpenDisplay(dnbuf)) == NULL) { ! debug2((errout, "failed to open display '%s'\n",dnbuf)); return NULL; } #if RANDR_MAJOR == 1 && RANDR_MINOR >= 2 && !defined(DISABLE_RANDR) ! /* Use Xrandr 1.2 if it's available */ ! if (XRRQueryExtension(mydisplay, &evb, &erb) != 0 && XRRQueryVersion(mydisplay, &majv, &minv) && majv == 1 && minv >= 2) { if (XSetErrorHandler(null_error_handler) == 0) { ! debug("get_displays failed on XSetErrorHandler\n"); XCloseDisplay(mydisplay); free_disppaths(disps); return NULL; --- 497,515 ---- strcpy(dnbuf,":0.0"); if ((mydisplay = XOpenDisplay(dnbuf)) == NULL) { ! debugrr2((errout, "failed to open display '%s'\n",dnbuf)); return NULL; } #if RANDR_MAJOR == 1 && RANDR_MINOR >= 2 && !defined(DISABLE_RANDR) ! /* Use Xrandr 1.2 if it's available, and if it's not disabled */ ! if (getenv("ARGYLL_IGNORE_XRANDR1_2") == NULL ! && XRRQueryExtension(mydisplay, &evb, &erb) != 0 && XRRQueryVersion(mydisplay, &majv, &minv) && majv == 1 && minv >= 2) { if (XSetErrorHandler(null_error_handler) == 0) { ! debugrr("get_displays failed on XSetErrorHandler\n"); XCloseDisplay(mydisplay); free_disppaths(disps); return NULL; *************** *** 502,508 **** XRRScreenResources *scrnres; if ((scrnres = XRRGetScreenResources(mydisplay, RootWindow(mydisplay,i))) == NULL) { ! debug("XRRGetScreenResources failed\n"); XCloseDisplay(mydisplay); free_disppaths(disps); return NULL; --- 522,528 ---- XRRScreenResources *scrnres; if ((scrnres = XRRGetScreenResources(mydisplay, RootWindow(mydisplay,i))) == NULL) { ! debugrr("XRRGetScreenResources failed\n"); XCloseDisplay(mydisplay); free_disppaths(disps); return NULL; *************** *** 514,520 **** XRRCrtcInfo *crtci; if ((outi = XRRGetOutputInfo(mydisplay, scrnres, scrnres->outputs[j])) == NULL) { ! debug("XRRGetOutputInfo failed\n"); XRRFreeScreenResources(scrnres); XCloseDisplay(mydisplay); free_disppaths(disps); --- 534,540 ---- XRRCrtcInfo *crtci; if ((outi = XRRGetOutputInfo(mydisplay, scrnres, scrnres->outputs[j])) == NULL) { ! debugrr("XRRGetOutputInfo failed\n"); XRRFreeScreenResources(scrnres); XCloseDisplay(mydisplay); free_disppaths(disps); *************** *** 524,529 **** --- 544,566 ---- if (outi->connection == RR_Disconnected) { continue; } + + /* Check that the VideoLUT's are accessible */ + { + XRRCrtcGamma *crtcgam; + + debugrr("Checking XRandR 1.2 VideoLUT access\n"); + if ((crtcgam = XRRGetCrtcGamma(mydisplay, outi->crtc)) == NULL + || crtcgam->size == 0) { + debugrr("XRandR 1.2 is faulty - falling back to older extensions\n"); + if (crtcgam != NULL) + XRRFreeGamma(crtcgam); + free_disppaths(disps); + disps = NULL; + j = scrnres->noutput; + continue; /* Abort XRandR 1.2 */ + } + } #ifdef NEVER { Atom *oprops; *************** *** 545,551 **** /* Add the output to the list */ if (disps == NULL) { if ((disps = (disppath **)calloc(sizeof(disppath *), 1 + 1)) == NULL) { ! debug("get_displays failed on malloc\n"); XRRFreeCrtcInfo(crtci); XRRFreeScreenResources(scrnres); XCloseDisplay(mydisplay); --- 582,588 ---- /* Add the output to the list */ if (disps == NULL) { if ((disps = (disppath **)calloc(sizeof(disppath *), 1 + 1)) == NULL) { ! debugrr("get_displays failed on malloc\n"); XRRFreeCrtcInfo(crtci); XRRFreeScreenResources(scrnres); XCloseDisplay(mydisplay); *************** *** 554,560 **** } else { if ((disps = (disppath **)realloc(disps, sizeof(disppath *) * (ndisps + 2))) == NULL) { ! debug("get_displays failed on malloc\n"); XRRFreeCrtcInfo(crtci); XRRFreeScreenResources(scrnres); XCloseDisplay(mydisplay); --- 591,597 ---- } else { if ((disps = (disppath **)realloc(disps, sizeof(disppath *) * (ndisps + 2))) == NULL) { ! debugrr("get_displays failed on malloc\n"); XRRFreeCrtcInfo(crtci); XRRFreeScreenResources(scrnres); XCloseDisplay(mydisplay); *************** *** 564,570 **** } /* ndisps is current display we're filling in */ if ((disps[ndisps] = calloc(sizeof(disppath),1)) == NULL) { ! debug("get_displays failed on malloc\n"); XRRFreeCrtcInfo(crtci); XRRFreeScreenResources(scrnres); XCloseDisplay(mydisplay); --- 601,607 ---- } /* ndisps is current display we're filling in */ if ((disps[ndisps] = calloc(sizeof(disppath),1)) == NULL) { ! debugrr("get_displays failed on malloc\n"); XRRFreeCrtcInfo(crtci); XRRFreeScreenResources(scrnres); XCloseDisplay(mydisplay); *************** *** 594,600 **** } } if ((disps[ndisps]->description = strdup(desc2)) == NULL) { ! debug("get_displays failed on malloc\n"); XRRFreeCrtcInfo(crtci); XRRFreeScreenResources(scrnres); XCloseDisplay(mydisplay); --- 631,637 ---- } } if ((disps[ndisps]->description = strdup(desc2)) == NULL) { ! debugrr("get_displays failed on malloc\n"); XRRFreeCrtcInfo(crtci); XRRFreeScreenResources(scrnres); XCloseDisplay(mydisplay); *************** *** 609,622 **** } } if ((disps[ndisps]->name = strdup(dnbuf)) == NULL) { ! debug("get_displays failed on malloc\n"); XRRFreeCrtcInfo(crtci); XRRFreeScreenResources(scrnres); XCloseDisplay(mydisplay); free_disppaths(disps); return NULL; } ! debug2((errout, "Display %d name = '%s'\n",ndisps,disps[ndisps]->name)); /* Create the X11 root atom of the default screen */ /* that may contain the associated ICC profile */ --- 646,659 ---- } } if ((disps[ndisps]->name = strdup(dnbuf)) == NULL) { ! debugrr("get_displays failed on malloc\n"); XRRFreeCrtcInfo(crtci); XRRFreeScreenResources(scrnres); XCloseDisplay(mydisplay); free_disppaths(disps); return NULL; } ! debugrr2((errout, "Display %d name = '%s'\n",ndisps,disps[ndisps]->name)); /* Create the X11 root atom of the default screen */ /* that may contain the associated ICC profile */ *************** *** 643,670 **** unsigned char *atomv = NULL; /* Get the atom for the EDID data */ ! if ((edid_atom = XInternAtom(mydisplay, "EDID_DATA", True)) == None) ! error("Unable to intern atom '%s'","EDID_DATA"); ! /* Get the EDID_DATA */ ! if (XRRGetOutputProperty(mydisplay, scrnres->outputs[j], edid_atom, ! 0, 0x7ffffff, False, False, XA_INTEGER, ! &ret_type, &ret_format, &ret_len, &ret_togo, &atomv) == Success && (ret_len == 128 || ret_len == 256)) { ! if ((disps[ndisps]->edid = malloc(sizeof(unsigned char) * ret_len)) == NULL) { ! debug("get_displays failed on malloc\n"); ! XRRFreeCrtcInfo(crtci); ! XRRFreeScreenResources(scrnres); ! XCloseDisplay(mydisplay); ! free_disppaths(disps); ! return NULL; } - memcpy(disps[ndisps]->edid, atomv, ret_len); - disps[ndisps]->edid_len = ret_len; - XFree(atomv); - debug2((errout, "Got EDID for display\n")); - } else { - debug2((errout, "Failed to get EDID for display\n")); } } --- 680,709 ---- unsigned char *atomv = NULL; /* Get the atom for the EDID data */ ! if ((edid_atom = XInternAtom(mydisplay, "EDID_DATA", True)) == None) { ! debugrr2((errout, "Unable to intern atom 'EDID_DATA'\n")); ! } else { ! /* Get the EDID_DATA */ ! if (XRRGetOutputProperty(mydisplay, scrnres->outputs[j], edid_atom, ! 0, 0x7ffffff, False, False, XA_INTEGER, ! &ret_type, &ret_format, &ret_len, &ret_togo, &atomv) == Success && (ret_len == 128 || ret_len == 256)) { ! if ((disps[ndisps]->edid = malloc(sizeof(unsigned char) * ret_len)) == NULL) { ! debugrr("get_displays failed on malloc\n"); ! XRRFreeCrtcInfo(crtci); ! XRRFreeScreenResources(scrnres); ! XCloseDisplay(mydisplay); ! free_disppaths(disps); ! return NULL; ! } ! memcpy(disps[ndisps]->edid, atomv, ret_len); ! disps[ndisps]->edid_len = ret_len; ! XFree(atomv); ! debugrr2((errout, "Got EDID for display\n")); ! } else { ! debugrr2((errout, "Failed to get EDID for display\n")); } } } *************** *** 678,694 **** } XSetErrorHandler(NULL); defsix = DefaultScreen(mydisplay); ! ! } else #endif /* randr >= V 1.2 */ ! { /* Use Older style identification */ if (XineramaQueryExtension(mydisplay, &evb, &erb) != 0 && XineramaIsActive(mydisplay)) { xai = XineramaQueryScreens(mydisplay, &dcount); if (xai == NULL || dcount == 0) { ! debug("XineramaQueryScreens failed\n"); XCloseDisplay(mydisplay); return NULL; } --- 717,735 ---- } XSetErrorHandler(NULL); defsix = DefaultScreen(mydisplay); ! } #endif /* randr >= V 1.2 */ ! ! if (disps == NULL) { /* Use Older style identification */ ! debugrr("get_displays checking for Xinerama\n"); ! if (XineramaQueryExtension(mydisplay, &evb, &erb) != 0 && XineramaIsActive(mydisplay)) { xai = XineramaQueryScreens(mydisplay, &dcount); if (xai == NULL || dcount == 0) { ! debugrr("XineramaQueryScreens failed\n"); XCloseDisplay(mydisplay); return NULL; } *************** *** 700,712 **** /* Allocate our list */ if ((disps = (disppath **)calloc(sizeof(disppath *), dcount + 1)) == NULL) { ! debug("get_displays failed on malloc\n"); XCloseDisplay(mydisplay); return NULL; } for (i = 0; i < dcount; i++) { if ((disps[i] = calloc(sizeof(disppath), 1)) == NULL) { ! debug("get_displays failed on malloc\n"); free_disppaths(disps); XCloseDisplay(mydisplay); return NULL; --- 741,753 ---- /* Allocate our list */ if ((disps = (disppath **)calloc(sizeof(disppath *), dcount + 1)) == NULL) { ! debugrr("get_displays failed on malloc\n"); XCloseDisplay(mydisplay); return NULL; } for (i = 0; i < dcount; i++) { if ((disps[i] = calloc(sizeof(disppath), 1)) == NULL) { ! debugrr("get_displays failed on malloc\n"); free_disppaths(disps); XCloseDisplay(mydisplay); return NULL; *************** *** 726,738 **** } } if ((disps[i]->name = strdup(dnbuf)) == NULL) { ! debug("get_displays failed on malloc\n"); free_disppaths(disps); XCloseDisplay(mydisplay); return NULL; } ! debug2((errout, "Display %d name = '%s'\n",i,disps[i]->name)); if (xai != NULL) { /* Xinerama */ disps[i]->screen = 0; /* We are asuming Xinerame creates a single virtual screen */ disps[i]->uscreen = i; /* We are assuming xinerama lists screens in the same order */ --- 767,779 ---- } } if ((disps[i]->name = strdup(dnbuf)) == NULL) { ! debugrr("get_displays failed on malloc\n"); free_disppaths(disps); XCloseDisplay(mydisplay); return NULL; } ! debugrr2((errout, "Display %d name = '%s'\n",i,disps[i]->name)); if (xai != NULL) { /* Xinerama */ disps[i]->screen = 0; /* We are asuming Xinerame creates a single virtual screen */ disps[i]->uscreen = i; /* We are assuming xinerama lists screens in the same order */ *************** *** 788,794 **** &ret_type, &ret_format, &ret_len, &ret_togo, &atomv) == Success && (ret_len == 128 || ret_len == 256)) { if ((disps[i]->edid = malloc(sizeof(unsigned char) * ret_len)) == NULL) { ! debug("get_displays failed on malloc\n"); free_disppaths(disps); XCloseDisplay(mydisplay); return NULL; --- 829,835 ---- &ret_type, &ret_format, &ret_len, &ret_togo, &atomv) == Success && (ret_len == 128 || ret_len == 256)) { if ((disps[i]->edid = malloc(sizeof(unsigned char) * ret_len)) == NULL) { ! debugrr("get_displays failed on malloc\n"); free_disppaths(disps); XCloseDisplay(mydisplay); return NULL; *************** *** 796,805 **** memcpy(disps[i]->edid, atomv, ret_len); disps[i]->edid_len = ret_len; XFree(atomv); ! debug2((errout, "Got EDID for display\n")); break; } else { ! debug2((errout, "Failed to get EDID for display\n")); } } --- 837,846 ---- memcpy(disps[i]->edid, atomv, ret_len); disps[i]->edid_len = ret_len; XFree(atomv); ! debugrr2((errout, "Got EDID for display\n")); break; } else { ! debugrr2((errout, "Failed to get EDID for display\n")); } } *************** *** 807,813 **** /* Some propietary multi-screen drivers (ie. TwinView & MergeFB) */ /* don't implement the XVidMode extension properly. */ if (XSetErrorHandler(null_error_handler) == 0) { ! debug("get_displays failed on XSetErrorHandler\n"); if (xai != NULL) XFree(xai); free_disppaths(disps); --- 848,854 ---- /* Some propietary multi-screen drivers (ie. TwinView & MergeFB) */ /* don't implement the XVidMode extension properly. */ if (XSetErrorHandler(null_error_handler) == 0) { ! debugrr("get_displays failed on XSetErrorHandler\n"); if (xai != NULL) XFree(xai); free_disppaths(disps); *************** *** 827,833 **** sprintf(desc2,"%s at %d, %d, width %d, height %d",desc1, disps[i]->sx, disps[i]->sy, disps[i]->sw, disps[i]->sh); if ((disps[i]->description = strdup(desc2)) == NULL) { ! debug("get_displays failed on malloc\n"); free_disppaths(disps); XCloseDisplay(mydisplay); return NULL; --- 868,874 ---- sprintf(desc2,"%s at %d, %d, width %d, height %d",desc1, disps[i]->sx, disps[i]->sy, disps[i]->sw, disps[i]->sh); if ((disps[i]->description = strdup(desc2)) == NULL) { ! debugrr("get_displays failed on malloc\n"); free_disppaths(disps); XCloseDisplay(mydisplay); return NULL; *************** *** 853,858 **** --- 894,900 ---- return disps; } + /* Free a whole list of display paths */ void free_disppaths(disppath **disps) { if (disps != NULL) { int i; *************** *** 873,879 **** free(disps); } } ! /* ----------------------------------------------- */ /* Deal with selecting a display */ --- 915,952 ---- free(disps); } } ! ! /* Delete a single display from the list of display paths */ ! void del_disppath(disppath **disps, int ix) { ! if (disps != NULL) { ! int i, j, k; ! for (i = 0; ; i++) { ! if (disps[i] == NULL) ! break; ! ! if (i == ix) { /* One to delete */ ! if (disps[i]->name != NULL) ! free(disps[i]->name); ! if (disps[i]->description != NULL) ! free(disps[i]->description); ! #if defined(UNIX) && !defined(__APPLE__) ! if (disps[i]->edid != NULL) ! free(disps[i]->edid); ! #endif ! free(disps[i]); ! ! /* Shuffle the rest down */ ! for (j = i, k = i + 1; ;j++, k++) { ! disps[j] = disps[k]; ! if (disps[k] == NULL) ! break; ! } ! return; ! } ! } ! } ! } ! /* ----------------------------------------------- */ /* Deal with selecting a display */ *************** *** 894,913 **** break; } if ((rv = malloc(sizeof(disppath))) == NULL) { ! debug("get_a_display failed malloc\n"); free_disppaths(paths); return NULL; } *rv = *paths[i]; /* Structure copy */ if ((rv->name = strdup(paths[i]->name)) == NULL) { ! debug("get_displays failed on malloc\n"); free(rv->description); free(rv); free_disppaths(paths); return NULL; } if ((rv->description = strdup(paths[i]->description)) == NULL) { ! debug("get_displays failed on malloc\n"); free(rv); free_disppaths(paths); return NULL; --- 967,986 ---- break; } if ((rv = malloc(sizeof(disppath))) == NULL) { ! debugrr("get_a_display failed malloc\n"); free_disppaths(paths); return NULL; } *rv = *paths[i]; /* Structure copy */ if ((rv->name = strdup(paths[i]->name)) == NULL) { ! debugrr("get_displays failed on malloc\n"); free(rv->description); free(rv); free_disppaths(paths); return NULL; } if ((rv->description = strdup(paths[i]->description)) == NULL) { ! debugrr("get_displays failed on malloc\n"); free(rv); free_disppaths(paths); return NULL; *************** *** 915,921 **** #if defined(UNIX) && !defined(__APPLE__) if (paths[i]->edid != NULL) { if ((rv->edid = malloc(sizeof(unsigned char) * 128)) == NULL) { ! debug("get_displays failed on malloc\n"); free(rv); free_disppaths(paths); return NULL; --- 988,994 ---- #if defined(UNIX) && !defined(__APPLE__) if (paths[i]->edid != NULL) { if ((rv->edid = malloc(sizeof(unsigned char) * 128)) == NULL) { ! debugrr("get_displays failed on malloc\n"); free(rv); free_disppaths(paths); return NULL; *************** *** 962,979 **** #ifdef NT WORD vals[3][256]; /* 16 bit elements */ ! debug("dispwin_get_ramdac called\n"); #ifdef NEVER /* Doesn't seem to return correct information on win2K systems */ if ((GetDeviceCaps(p->hdc, COLORMGMTCAPS) & CM_GAMMA_RAMP) == 0) { ! debug("dispwin_get_ramdac failed on GetDeviceCaps(CM_GAMMA_RAMP)\n"); return NULL; } #endif /* Allocate a ramdac */ if ((r = (ramdac *)calloc(sizeof(ramdac), 1)) == NULL) { ! debug("dispwin_get_ramdac failed on malloc()\n"); return NULL; } r->pdepth = p->pdepth; --- 1035,1052 ---- #ifdef NT WORD vals[3][256]; /* 16 bit elements */ ! debugr("dispwin_get_ramdac called\n"); #ifdef NEVER /* Doesn't seem to return correct information on win2K systems */ if ((GetDeviceCaps(p->hdc, COLORMGMTCAPS) & CM_GAMMA_RAMP) == 0) { ! debugr("dispwin_get_ramdac failed on GetDeviceCaps(CM_GAMMA_RAMP)\n"); return NULL; } #endif /* Allocate a ramdac */ if ((r = (ramdac *)calloc(sizeof(ramdac), 1)) == NULL) { ! debugr("dispwin_get_ramdac failed on malloc()\n"); return NULL; } r->pdepth = p->pdepth; *************** *** 988,1006 **** for (j--; j >= 0; j--) free(r->v[j]); free(r); ! debug("dispwin_get_ramdac failed on malloc()\n"); return NULL; } } /* GetDeviceGammaRamp() is hard coded for 3 x 256 entries */ if (r->nent != 256) { ! debug2((errout,"GetDeviceGammaRamp() is hard coded for nent == 256, and we've got nent = %d!\n",r->nent)); return NULL; } if (GetDeviceGammaRamp(p->hdc, vals) == 0) { ! debug("dispwin_get_ramdac failed on GetDeviceGammaRamp()\n"); return NULL; } for (j = 0; j < 3; j++) { --- 1061,1079 ---- for (j--; j >= 0; j--) free(r->v[j]); free(r); ! debugr("dispwin_get_ramdac failed on malloc()\n"); return NULL; } } /* GetDeviceGammaRamp() is hard coded for 3 x 256 entries */ if (r->nent != 256) { ! debugr2((errout,"GetDeviceGammaRamp() is hard coded for nent == 256, and we've got nent = %d!\n",r->nent)); return NULL; } if (GetDeviceGammaRamp(p->hdc, vals) == 0) { ! debugr("dispwin_get_ramdac failed on GetDeviceGammaRamp()\n"); return NULL; } for (j = 0; j < 3; j++) { *************** *** 1014,1039 **** unsigned int nent; CGGammaValue vals[3][16385]; ! debug("dispwin_get_ramdac called\n"); if (CGGetDisplayTransferByTable(p->ddid, 163845, vals[0], vals[1], vals[2], &nent) != 0) { ! debug("CGGetDisplayTransferByTable failed\n"); return NULL; } if (nent == 16385) { /* oops - we didn't provide enought space! */ ! debug("CGGetDisplayTransferByTable has more entries than we can handle\n"); return NULL; } if (nent != (1 << p->pdepth)) { ! debug("CGGetDisplayTransferByTable number of entries mismatches screen depth\n"); return NULL; } /* Allocate a ramdac */ if ((r = (ramdac *)calloc(sizeof(ramdac), 1)) == NULL) { ! debug("dispwin_get_ramdac failed on malloc()\n"); return NULL; } --- 1087,1112 ---- unsigned int nent; CGGammaValue vals[3][16385]; ! debugr("dispwin_get_ramdac called\n"); if (CGGetDisplayTransferByTable(p->ddid, 163845, vals[0], vals[1], vals[2], &nent) != 0) { ! debugr("CGGetDisplayTransferByTable failed\n"); return NULL; } if (nent == 16385) { /* oops - we didn't provide enought space! */ ! debugr("CGGetDisplayTransferByTable has more entries than we can handle\n"); return NULL; } if (nent != (1 << p->pdepth)) { ! debugr("CGGetDisplayTransferByTable number of entries mismatches screen depth\n"); return NULL; } /* Allocate a ramdac */ if ((r = (ramdac *)calloc(sizeof(ramdac), 1)) == NULL) { ! debugr("dispwin_get_ramdac failed on malloc()\n"); return NULL; } *************** *** 1048,1054 **** for (j--; j >= 0; j--) free(r->v[j]); free(r); ! debug("dispwin_get_ramdac failed on malloc()\n"); return NULL; } } --- 1121,1127 ---- for (j--; j >= 0; j--) free(r->v[j]); free(r); ! debugr("dispwin_get_ramdac failed on malloc()\n"); return NULL; } } *************** *** 1065,1093 **** int nent = 0; int evb = 0, erb = 0; ! debug("dispwin_get_ramdac called\n"); #if RANDR_MAJOR == 1 && RANDR_MINOR >= 2 && !defined(DISABLE_RANDR) if (p->crtc != 0) { /* Using Xrandr 1.2 */ XRRCrtcGamma *crtcgam; int nz = 0; ! debug("Getting gamma using Randr 1.2\n"); if ((crtcgam = XRRGetCrtcGamma(p->mydisplay, p->crtc)) == NULL) { ! debug("XRRGetCrtcGamma failed\n"); return NULL; } nent = crtcgam->size; if (nent > 16384) { ! debug("XRRGetCrtcGammaSize has more entries than we can handle\n"); return NULL; } if (nent != (1 << p->pdepth)) { ! debug2((errout,"XRRGetCrtcGammaSize number of entries %d mismatches screen depth %d\n",nent,(1 << p->pdepth))); return NULL; } --- 1138,1166 ---- int nent = 0; int evb = 0, erb = 0; ! debugr("dispwin_get_ramdac called\n"); #if RANDR_MAJOR == 1 && RANDR_MINOR >= 2 && !defined(DISABLE_RANDR) if (p->crtc != 0) { /* Using Xrandr 1.2 */ XRRCrtcGamma *crtcgam; int nz = 0; ! debugr("Getting gamma using Randr 1.2\n"); if ((crtcgam = XRRGetCrtcGamma(p->mydisplay, p->crtc)) == NULL) { ! debugr("XRRGetCrtcGamma failed\n"); return NULL; } nent = crtcgam->size; if (nent > 16384) { ! debugr("XRRGetCrtcGammaSize has more entries than we can handle\n"); return NULL; } if (nent != (1 << p->pdepth)) { ! debugr2((errout,"XRRGetCrtcGammaSize number of entries %d mismatches screen depth %d\n",nent,(1 << p->pdepth))); return NULL; } *************** *** 1101,1107 **** /* Compensate for XRandR 1.2 startup bug */ if (nz == 0) { ! debug("Detected XRandR 1.2 bug ? Assuming linear ramp!\n"); for (i = 0; i < nent; i++) { for (j = 0; j < 3; j++) vals[j][i] = (int)(65535.0 * i/(nent-1.0) + 0.5); --- 1174,1180 ---- /* Compensate for XRandR 1.2 startup bug */ if (nz == 0) { ! debugr("Detected XRandR 1.2 bug ? Assuming linear ramp!\n"); for (i = 0; i < nent; i++) { for (j = 0; j < 3; j++) vals[j][i] = (int)(65535.0 * i/(nent-1.0) + 0.5); *************** *** 1115,1161 **** { if (XF86VidModeQueryExtension(p->mydisplay, &evb, &erb) == 0) { ! debug("XF86VidModeQueryExtension failed\n"); return NULL; } /* Some propietary multi-screen drivers (ie. TwinView & MergedFB) */ /* don't implement the XVidMode extenstion properly. */ if (XSetErrorHandler(null_error_handler) == 0) { ! debug("get_displays failed on XSetErrorHandler\n"); return NULL; } nent = -1; if (XF86VidModeGetGammaRampSize(p->mydisplay, p->myrscreen, &nent) == 0 || nent == -1) { XSetErrorHandler(NULL); ! debug("XF86VidModeGetGammaRampSize failed\n"); return NULL; } XSetErrorHandler(NULL); /* Restore handler */ if (nent == 0) { ! debug("XF86VidModeGetGammaRampSize returned 0 size\n"); return NULL; } if (nent > 16384) { ! debug("XF86VidModeGetGammaRampSize has more entries than we can handle\n"); return NULL; } if (XF86VidModeGetGammaRamp(p->mydisplay, p->myrscreen, nent, vals[0], vals[1], vals[2]) == 0) { ! debug("XF86VidModeGetGammaRamp failed\n"); return NULL; } if (nent != (1 << p->pdepth)) { ! debug2((errout,"CGGetDisplayTransferByTable number of entries %d mismatches screen depth %d\n",nent,(1 << p->pdepth))); return NULL; } } /* Allocate a ramdac */ if ((r = (ramdac *)calloc(sizeof(ramdac), 1)) == NULL) { ! debug("dispwin_get_ramdac failed on malloc()\n"); return NULL; } --- 1188,1234 ---- { if (XF86VidModeQueryExtension(p->mydisplay, &evb, &erb) == 0) { ! debugr("XF86VidModeQueryExtension failed\n"); return NULL; } /* Some propietary multi-screen drivers (ie. TwinView & MergedFB) */ /* don't implement the XVidMode extenstion properly. */ if (XSetErrorHandler(null_error_handler) == 0) { ! debugr("get_displays failed on XSetErrorHandler\n"); return NULL; } nent = -1; if (XF86VidModeGetGammaRampSize(p->mydisplay, p->myrscreen, &nent) == 0 || nent == -1) { XSetErrorHandler(NULL); ! debugr("XF86VidModeGetGammaRampSize failed\n"); return NULL; } XSetErrorHandler(NULL); /* Restore handler */ if (nent == 0) { ! debugr("XF86VidModeGetGammaRampSize returned 0 size\n"); return NULL; } if (nent > 16384) { ! debugr("XF86VidModeGetGammaRampSize has more entries than we can handle\n"); return NULL; } if (XF86VidModeGetGammaRamp(p->mydisplay, p->myrscreen, nent, vals[0], vals[1], vals[2]) == 0) { ! debugr("XF86VidModeGetGammaRamp failed\n"); return NULL; } if (nent != (1 << p->pdepth)) { ! debugr2((errout,"CGGetDisplayTransferByTable number of entries %d mismatches screen depth %d\n",nent,(1 << p->pdepth))); return NULL; } } /* Allocate a ramdac */ if ((r = (ramdac *)calloc(sizeof(ramdac), 1)) == NULL) { ! debugr("dispwin_get_ramdac failed on malloc()\n"); return NULL; } *************** *** 1170,1176 **** for (j--; j >= 0; j--) free(r->v[j]); free(r); ! debug("dispwin_get_ramdac failed on malloc()\n"); return NULL; } } --- 1243,1249 ---- for (j--; j >= 0; j--) free(r->v[j]); free(r); ! debugr("dispwin_get_ramdac failed on malloc()\n"); return NULL; } } *************** *** 1232,1242 **** #ifdef NT WORD vals[3][256]; /* 16 bit elements */ ! debug("dispwin_set_ramdac called\n"); #ifdef NEVER /* Doesn't seem to return correct information on win2K systems */ if ((GetDeviceCaps(p->hdc, COLORMGMTCAPS) & CM_GAMMA_RAMP) == 0) { ! debug("dispwin_set_ramdac failed on GetDeviceCaps(CM_GAMMA_RAMP)\n"); return 1; } #endif --- 1305,1315 ---- #ifdef NT WORD vals[3][256]; /* 16 bit elements */ ! debugr("dispwin_set_ramdac called\n"); #ifdef NEVER /* Doesn't seem to return correct information on win2K systems */ if ((GetDeviceCaps(p->hdc, COLORMGMTCAPS) & CM_GAMMA_RAMP) == 0) { ! debugr("dispwin_set_ramdac failed on GetDeviceCaps(CM_GAMMA_RAMP)\n"); return 1; } #endif *************** *** 1253,1259 **** } if (SetDeviceGammaRamp(p->hdc, vals) == 0) { ! debug("dispwin_set_ramdac failed on SetDeviceGammaRamp()\n"); return 1; } #endif /* NT */ --- 1326,1332 ---- } if (SetDeviceGammaRamp(p->hdc, vals) == 0) { ! debugr("dispwin_set_ramdac failed on SetDeviceGammaRamp()\n"); return 1; } #endif /* NT */ *************** *** 1262,1268 **** { /* Transient first */ CGGammaValue vals[3][16384]; ! debug("dispwin_set_ramdac called\n"); for (j = 0; j < 3; j++) { for (i = 0; i < r->nent; i++) { --- 1335,1341 ---- { /* Transient first */ CGGammaValue vals[3][16384]; ! debugr("dispwin_set_ramdac called\n"); for (j = 0; j < 3; j++) { for (i = 0; i < r->nent; i++) { *************** *** 1276,1282 **** } if (CGSetDisplayTransferByTable(p->ddid, r->nent, vals[0], vals[1], vals[2]) != 0) { ! debug("CGSetDisplayTransferByTable failed\n"); return 1; } --- 1349,1355 ---- } if (CGSetDisplayTransferByTable(p->ddid, r->nent, vals[0], vals[1], vals[2]) != 0) { ! debugr("CGSetDisplayTransferByTable failed\n"); return 1; } *************** *** 1301,1333 **** int size; int i, j; ! debug("Set_ramdac persist\n"); /* Get the current installed profile */ if ((ev = CMGetProfileByAVID((CMDisplayIDType)p->ddid, &prof)) != noErr) { ! debug2((errout,"CMGetProfileByAVID() failed for display '%s' with error %d\n",p->name,ev)); return 1; } /* Get the current installed profile's location */ if ((ev = NCMGetProfileLocation(prof, &ploc, &plocsz)) != noErr) { ! debug2((errout,"NCMGetProfileLocation() failed for display '%s' with error %d\n",p->name,ev)); return 1; } ! debug2((errout, "Current profile path = '%s'\n",plocpath(&ploc))); if ((tpath = plocpath(&ploc)) == NULL) { ! debug2((errout,"plocpath failed for display '%s'\n",p->name)); return 1; } if (strlen(tpath) > 255) { ! debug2((errout,"current profile path is too long\n")); return 1; } if ((ppath = malloc(strlen(tpath) + 6)) == NULL) { ! debug2((errout,"malloc failed for display '%s'\n",p->name)); free(tpath); return 1; } --- 1374,1406 ---- int size; int i, j; ! debugr("Set_ramdac persist\n"); /* Get the current installed profile */ if ((ev = CMGetProfileByAVID((CMDisplayIDType)p->ddid, &prof)) != noErr) { ! debugr2((errout,"CMGetProfileByAVID() failed for display '%s' with error %d\n",p->name,ev)); return 1; } /* Get the current installed profile's location */ if ((ev = NCMGetProfileLocation(prof, &ploc, &plocsz)) != noErr) { ! debugr2((errout,"NCMGetProfileLocation() failed for display '%s' with error %d\n",p->name,ev)); return 1; } ! debugr2((errout, "Current profile path = '%s'\n",plocpath(&ploc))); if ((tpath = plocpath(&ploc)) == NULL) { ! debugr2((errout,"plocpath failed for display '%s'\n",p->name)); return 1; } if (strlen(tpath) > 255) { ! debugr2((errout,"current profile path is too long\n")); return 1; } if ((ppath = malloc(strlen(tpath) + 6)) == NULL) { ! debugr2((errout,"malloc failed for display '%s'\n",p->name)); free(tpath); return 1; } *************** *** 1336,1345 **** /* Rename the currently installed profile temporarily */ if (rename(tpath, ppath) != 0) { ! debug2((errout,"Renaming existing profile '%s' failed\n",ppath)); return 2; } ! debug2((errout,"Renamed current profile '%s' to '%s'\n",tpath,ppath)); /* Make a copy of the renamed current profile back to it's true name */ tploc.locType = cmPathBasedProfile; --- 1409,1418 ---- /* Rename the currently installed profile temporarily */ if (rename(tpath, ppath) != 0) { ! debugr2((errout,"Renaming existing profile '%s' failed\n",ppath)); return 2; } ! debugr2((errout,"Renamed current profile '%s' to '%s'\n",tpath,ppath)); /* Make a copy of the renamed current profile back to it's true name */ tploc.locType = cmPathBasedProfile; *************** *** 1348,1354 **** /* Make the temporary copy */ if ((ev = CMCopyProfile(&tprof, &tploc, prof)) != noErr) { ! debug2((errout,"CMCopyProfile() failed for display '%s' with error %d\n",p->name,ev)); CMCloseProfile(prof); unlink(tpath); rename(ppath, tpath); --- 1421,1427 ---- /* Make the temporary copy */ if ((ev = CMCopyProfile(&tprof, &tploc, prof)) != noErr) { ! debugr2((errout,"CMCopyProfile() failed for display '%s' with error %d\n",p->name,ev)); CMCloseProfile(prof); unlink(tpath); rename(ppath, tpath); *************** *** 1357,1363 **** CMCloseProfile(prof); if ((ev = CMSetProfileDescriptions(tprof, "Dispwin Temp", 13, NULL, 0, NULL, 0)) != noErr) { ! debug2((errout,"cmVideoCardGammaTag`() failed for display '%s' with error %d\n",p->name,ev)); CMCloseProfile(tprof); unlink(tpath); rename(ppath, tpath); --- 1430,1436 ---- CMCloseProfile(prof); if ((ev = CMSetProfileDescriptions(tprof, "Dispwin Temp", 13, NULL, 0, NULL, 0)) != noErr) { ! debugr2((errout,"cmVideoCardGammaTag`() failed for display '%s' with error %d\n",p->name,ev)); CMCloseProfile(tprof); unlink(tpath); rename(ppath, tpath); *************** *** 1366,1372 **** /* Change the description and set the vcgt tag to the calibration */ if ((vcgt = malloc(size = (sizeof(CMVideoCardGammaType) - 1 + 3 * 2 * r->nent))) == NULL) { ! debug2((errout,"malloc of vcgt tag failed for display '%s' with error %d\n",p->name,ev)); CMCloseProfile(tprof); unlink(tpath); rename(ppath, tpath); --- 1439,1445 ---- /* Change the description and set the vcgt tag to the calibration */ if ((vcgt = malloc(size = (sizeof(CMVideoCardGammaType) - 1 + 3 * 2 * r->nent))) == NULL) { ! debugr2((errout,"malloc of vcgt tag failed for display '%s' with error %d\n",p->name,ev)); CMCloseProfile(tprof); unlink(tpath); rename(ppath, tpath); *************** *** 1393,1399 **** /* Replace or add a vcgt tag */ if ((ev = CMSetProfileElement(tprof, cmVideoCardGammaTag, size, vcgt)) != noErr) { ! debug2((errout,"CMSetProfileElement vcgt tag failed with error %d\n",ev)); free(vcgt); CMCloseProfile(tprof); unlink(tpath); --- 1466,1472 ---- /* Replace or add a vcgt tag */ if ((ev = CMSetProfileElement(tprof, cmVideoCardGammaTag, size, vcgt)) != noErr) { ! debugr2((errout,"CMSetProfileElement vcgt tag failed with error %d\n",ev)); free(vcgt); CMCloseProfile(tprof); unlink(tpath); *************** *** 1403,1409 **** free(vcgt); if ((ev = CMUpdateProfile(tprof)) != noErr) { ! debug2((errout,"CMUpdateProfile failed with error %d\n",ev)); CMCloseProfile(tprof); unlink(tpath); rename(ppath, tpath); --- 1476,1482 ---- free(vcgt); if ((ev = CMUpdateProfile(tprof)) != noErr) { ! debugr2((errout,"CMUpdateProfile failed with error %d\n",ev)); CMCloseProfile(tprof); unlink(tpath); rename(ppath, tpath); *************** *** 1412,1435 **** /* Make temporary file the current profile - updates LUTs */ if ((ev = CMSetProfileByAVID((CMDisplayIDType)p->ddid, tprof)) != noErr) { ! debug2((errout,"CMSetProfileByAVID() failed for display '%s' with error %d\n",p->name,ev)); CMCloseProfile(tprof); unlink(tpath); rename(ppath, tpath); return 1; } CMCloseProfile(tprof); ! debug2((errout,"Set display to use temporary profile '%s'\n",tpath)); /* Delete the temporary profile */ unlink(tpath); /* Rename the current profile back to it's correct name */ if (rename(ppath, tpath) != 0) { ! debug2((errout,"Renaming existing profile '%s' failed\n",ppath)); return 1; } ! debug2((errout,"Restored '%s' back to '%s'\n",ppath,tpath)); } #endif /* __APPLE__ */ --- 1485,1508 ---- /* Make temporary file the current profile - updates LUTs */ if ((ev = CMSetProfileByAVID((CMDisplayIDType)p->ddid, tprof)) != noErr) { ! debugr2((errout,"CMSetProfileByAVID() failed for display '%s' with error %d\n",p->name,ev)); CMCloseProfile(tprof); unlink(tpath); rename(ppath, tpath); return 1; } CMCloseProfile(tprof); ! debugr2((errout,"Set display to use temporary profile '%s'\n",tpath)); /* Delete the temporary profile */ unlink(tpath); /* Rename the current profile back to it's correct name */ if (rename(ppath, tpath) != 0) { ! debugr2((errout,"Renaming existing profile '%s' failed\n",ppath)); return 1; } ! debugr2((errout,"Restored '%s' back to '%s'\n",ppath,tpath)); } #endif /* __APPLE__ */ *************** *** 1437,1443 **** #if defined(UNIX) && !defined(__APPLE__) unsigned short vals[3][16384]; ! debug("dispwin_set_ramdac called\n"); for (j = 0; j < 3; j++) { for (i = 0; i < r->nent; i++) { --- 1510,1516 ---- #if defined(UNIX) && !defined(__APPLE__) unsigned short vals[3][16384]; ! debugr("dispwin_set_ramdac called\n"); for (j = 0; j < 3; j++) { for (i = 0; i < r->nent; i++) { *************** *** 1454,1463 **** if (p->crtc != 0) { /* Using Xrandr 1.2 */ XRRCrtcGamma *crtcgam; ! debug("Setting gamma using Randr 1.2\n"); if ((crtcgam = XRRAllocGamma(r->nent)) == NULL) { ! debug(" XRRAllocGamma failed\n"); return 1; } --- 1527,1536 ---- if (p->crtc != 0) { /* Using Xrandr 1.2 */ XRRCrtcGamma *crtcgam; ! debugr("Setting gamma using Randr 1.2\n"); if ((crtcgam = XRRAllocGamma(r->nent)) == NULL) { ! debugr(" XRRAllocGamma failed\n"); return 1; } *************** *** 1478,1489 **** /* Some propietary multi-screen drivers (ie. TwinView & MergedFB) */ /* don't implement the XVidMode extenstion properly. */ if (XSetErrorHandler(null_error_handler) == 0) { ! debug("get_displays failed on XSetErrorHandler\n"); return 1; } if (XF86VidModeSetGammaRamp(p->mydisplay, p->myrscreen, r->nent, vals[0], vals[1], vals[2]) == 0) { XSetErrorHandler(NULL); ! debug("XF86VidModeSetGammaRamp failed\n"); return 1; } XSync(p->mydisplay, False); /* Flush the change out */ --- 1551,1562 ---- /* Some propietary multi-screen drivers (ie. TwinView & MergedFB) */ /* don't implement the XVidMode extenstion properly. */ if (XSetErrorHandler(null_error_handler) == 0) { ! debugr("get_displays failed on XSetErrorHandler\n"); return 1; } if (XF86VidModeSetGammaRamp(p->mydisplay, p->myrscreen, r->nent, vals[0], vals[1], vals[2]) == 0) { XSetErrorHandler(NULL); ! debugr("XF86VidModeSetGammaRamp failed\n"); return 1; } XSync(p->mydisplay, False); /* Flush the change out */ *************** *** 1573,1601 **** if ((fp = fopen(fname,"r")) == NULL) #endif { ! debug2((errout,"Can't open file '%s'\n",fname)); return 1; } /* Figure out how big it is */ if (fseek(fp, 0, SEEK_END)) { ! debug2((errout,"Seek '%s' to EOF failed\n",fname)); return 1; } psize = (unsigned long)ftell(fp); if (fseek(fp, 0, SEEK_SET)) { ! debug2((errout,"Seek '%s' to SOF failed\n",fname)); return 1; } if ((atomv = (unsigned char *)malloc(psize)) == NULL) { ! debug2((errout,"Failed to allocate buffer for profile '%s'\n",fname)); return 1; } if ((bread = fread(atomv, 1, psize, fp)) != psize) { ! debug2((errout,"Failed to read profile '%s' into buffer\n",fname)); return 1; } --- 1646,1674 ---- if ((fp = fopen(fname,"r")) == NULL) #endif { ! debugr2((errout,"Can't open file '%s'\n",fname)); return 1; } /* Figure out how big it is */ if (fseek(fp, 0, SEEK_END)) { ! debugr2((errout,"Seek '%s' to EOF failed\n",fname)); return 1; } psize = (unsigned long)ftell(fp); if (fseek(fp, 0, SEEK_SET)) { ! debugr2((errout,"Seek '%s' to SOF failed\n",fname)); return 1; } if ((atomv = (unsigned char *)malloc(psize)) == NULL) { ! debugr2((errout,"Failed to allocate buffer for profile '%s'\n",fname)); return 1; } if ((bread = fread(atomv, 1, psize, fp)) != psize) { ! debugr2((errout,"Failed to read profile '%s' into buffer\n",fname)); return 1; } *************** *** 1634,1659 **** WCS_PROFILE_MANAGEMENT_SCOPE wcssc; unsigned short *wpath, *wbname, *wmonid; ! debug2((errout,"dispwin_install_profile got '%s'\n",fname)); if (GetColorDirectory(NULL, colpath, &colpathlen) == 0) { ! debug2((errout,"Getting color directory failed\n")); return 1; } if ((fullpath = _fullpath(NULL, fname, 0)) == NULL) { ! debug2((errout,"_fullpath() failed\n")); return 1; } if ((basename = PathFindFileName(fullpath)) == NULL) { ! debug2((errout,"Locating base name in '%s' failed\n",fname)); free(fullpath); return 1; } if ((strlen(colpath) + strlen(basename) + 2) > MAX_PATH) { ! debug2((errout,"Installed profile path too long\n")); free(fullpath); return 1; } --- 1707,1732 ---- WCS_PROFILE_MANAGEMENT_SCOPE wcssc; unsigned short *wpath, *wbname, *wmonid; ! debugr2((errout,"dispwin_install_profile got '%s'\n",fname)); if (GetColorDirectory(NULL, colpath, &colpathlen) == 0) { ! debugr2((errout,"Getting color directory failed\n")); return 1; } if ((fullpath = _fullpath(NULL, fname, 0)) == NULL) { ! debugr2((errout,"_fullpath() failed\n")); return 1; } if ((basename = PathFindFileName(fullpath)) == NULL) { ! debugr2((errout,"Locating base name in '%s' failed\n",fname)); free(fullpath); return 1; } if ((strlen(colpath) + strlen(basename) + 2) > MAX_PATH) { ! debugr2((errout,"Installed profile path too long\n")); free(fullpath); return 1; } *************** *** 1667,1693 **** wcssc = WCS_PROFILE_MANAGEMENT_SCOPE_CURRENT_USER; if ((wpath = char2wchar(fullpath)) == NULL) { ! debug2((errout,"char2wchar failed\n")); free(fullpath); return 1; } if ((wbname = char2wchar(basename)) == NULL) { ! debug2((errout,"char2wchar failed\n")); free(wpath); free(fullpath); return 1; } if ((wmonid = char2wchar(p->monid)) == NULL) { ! debug2((errout,"char2wchar failed\n")); free(wbname); free(wpath); free(fullpath); return 1; } ! debug2((errout,"Installing '%s'\n",fname)); /* Install doesn't replace an existing installed profile, */ /* so we need to try and delete this profile first */ --- 1740,1766 ---- wcssc = WCS_PROFILE_MANAGEMENT_SCOPE_CURRENT_USER; if ((wpath = char2wchar(fullpath)) == NULL) { ! debugr2((errout,"char2wchar failed\n")); free(fullpath); return 1; } if ((wbname = char2wchar(basename)) == NULL) { ! debugr2((errout,"char2wchar failed\n")); free(wpath); free(fullpath); return 1; } if ((wmonid = char2wchar(p->monid)) == NULL) { ! debugr2((errout,"char2wchar failed\n")); free(wbname); free(wpath); free(fullpath); return 1; } ! debugr2((errout,"Installing '%s'\n",fname)); /* Install doesn't replace an existing installed profile, */ /* so we need to try and delete this profile first */ *************** *** 1702,1708 **** } if (InstallColorProfile(NULL, fullpath) == 0) { ! debug2((errout,"InstallColorProfile() failed for file '%s' with error %d\n",fname,GetLastError())); free(wmonid); free(wbname); free(wpath); --- 1775,1781 ---- } if (InstallColorProfile(NULL, fullpath) == 0) { ! debugr2((errout,"InstallColorProfile() failed for file '%s' with error %d\n",fname,GetLastError())); free(wmonid); free(wbname); free(wpath); *************** *** 1710,1720 **** return 1; } ! debug2((errout,"Associating '%s' with '%s'\n",fullpath,p->monid)); if (pWcsAssociateColorProfileWithDevice != NULL) { ! debug("Using Vista Associate\n"); if ((*pWcsAssociateColorProfileWithDevice)(wcssc, wpath, wmonid) == 0) { ! debug2((errout,"WcsAssociateColorProfileWithDevice() failed for file '%s' with error %d\n",fullpath,GetLastError())); free(wmonid); free(wbname); free(wpath); --- 1783,1793 ---- return 1; } ! debugr2((errout,"Associating '%s' with '%s'\n",fullpath,p->monid)); if (pWcsAssociateColorProfileWithDevice != NULL) { ! debugr("Using Vista Associate\n"); if ((*pWcsAssociateColorProfileWithDevice)(wcssc, wpath, wmonid) == 0) { ! debugr2((errout,"WcsAssociateColorProfileWithDevice() failed for file '%s' with error %d\n",fullpath,GetLastError())); free(wmonid); free(wbname); free(wpath); *************** *** 1723,1729 **** } } else { if (AssociateColorProfileWithDevice(NULL, fullpath, p->monid) == 0) { ! debug2((errout,"AssociateColorProfileWithDevice() failed for file '%s' with error %d\n",fullpath,GetLastError())); free(wmonid); free(wbname); free(wpath); --- 1796,1802 ---- } } else { if (AssociateColorProfileWithDevice(NULL, fullpath, p->monid) == 0) { ! debugr2((errout,"AssociateColorProfileWithDevice() failed for file '%s' with error %d\n",fullpath,GetLastError())); free(wmonid); free(wbname); free(wpath); *************** *** 1771,1783 **** /* Locate the appropriate ColorSync path */ if ((ev = FSFindFolder(vref, kColorSyncProfilesFolderType, kCreateFolder, &dirref)) != noErr) { ! debug2((errout,"FSFindFolder() failed with error %d\n",ev)); return 1; } /* Convert to POSIX path */ if ((ev = FSRefMakePath(&dirref, (unsigned char *)dpath, FILENAME_MAX)) != noErr) { ! debug2((errout,"FSRefMakePath failed with error %d\n",ev)); return 1; } --- 1844,1856 ---- /* Locate the appropriate ColorSync path */ if ((ev = FSFindFolder(vref, kColorSyncProfilesFolderType, kCreateFolder, &dirref)) != noErr) { ! debugr2((errout,"FSFindFolder() failed with error %d\n",ev)); return 1; } /* Convert to POSIX path */ if ((ev = FSRefMakePath(&dirref, (unsigned char *)dpath, FILENAME_MAX)) != noErr) { ! debugr2((errout,"FSRefMakePath failed with error %d\n",ev)); return 1; } *************** *** 1790,1810 **** /* Append the basename to the ColorSync directory path */ if ((strlen(dpath) + strlen(basename) + 2) > FILENAME_MAX || (strlen(dpath) + strlen(basename) + 2) > 256) { ! debug2((errout,"ColorSync dir + profile name too long\n")); return 1; } strcat(dpath, "/"); strcat(dpath, basename); ! debug2((errout,"Destination profile '%s'\n",dpath)); /* Open the profile we want to install */ ploc.locType = cmPathBasedProfile; strncpy(ploc.u.pathLoc.path, fname, 255); ploc.u.pathLoc.path[255] = '\000'; ! debug2((errout,"Source profile '%s'\n",fname)); if ((ev = CMOpenProfile(&prof, &ploc)) != noErr) { ! debug2((errout,"CMOpenProfile() failed for file '%s' with error %d\n",fname,ev)); return 1; } --- 1863,1883 ---- /* Append the basename to the ColorSync directory path */ if ((strlen(dpath) + strlen(basename) + 2) > FILENAME_MAX || (strlen(dpath) + strlen(basename) + 2) > 256) { ! debugr2((errout,"ColorSync dir + profile name too long\n")); return 1; } strcat(dpath, "/"); strcat(dpath, basename); ! debugr2((errout,"Destination profile '%s'\n",dpath)); /* Open the profile we want to install */ ploc.locType = cmPathBasedProfile; strncpy(ploc.u.pathLoc.path, fname, 255); ploc.u.pathLoc.path[255] = '\000'; ! debugr2((errout,"Source profile '%s'\n",fname)); if ((ev = CMOpenProfile(&prof, &ploc)) != noErr) { ! debugr2((errout,"CMOpenProfile() failed for file '%s' with error %d\n",fname,ev)); return 1; } *************** *** 1817,1829 **** dploc.u.pathLoc.path[255] = '\000'; if ((ev = CMCopyProfile(&dprof, &dploc, prof)) != noErr) { ! debug2((errout,"CMCopyProfile() failed for file '%s' with error %d\n",dpath,ev)); return 1; } /* Make it the current profile - updates LUTs */ if ((ev = CMSetProfileByAVID((CMDisplayIDType)p->ddid, dprof)) != noErr) { ! debug2((errout,"CMSetProfileByAVID() failed for file '%s' with error %d\n",fname,ev)); return 1; } CMCloseProfile(prof); --- 1890,1902 ---- dploc.u.pathLoc.path[255] = '\000'; if ((ev = CMCopyProfile(&dprof, &dploc, prof)) != noErr) { ! debugr2((errout,"CMCopyProfile() failed for file '%s' with error %d\n",dpath,ev)); return 1; } /* Make it the current profile - updates LUTs */ if ((ev = CMSetProfileByAVID((CMDisplayIDType)p->ddid, dprof)) != noErr) { ! debugr2((errout,"CMSetProfileByAVID() failed for file '%s' with error %d\n",fname,ev)); return 1; } CMCloseProfile(prof); *************** *** 1850,1868 **** sc = ucmm_user; if ((ev = ucmm_install_monitor_profile(sc, p->edid, p->edid_len, p->name, fname)) != ucmm_ok) { ! debug2((errout,"Installing profile '%s' failed with error %d\n",fname,ev)); return 1; } if ((rv = set_X11_atom(p, fname)) != 0) { ! debug2((errout,"Setting X11 atom failed")); return 1; } /* X11 doesn't set the display to the current profile calibration, */ /* so we do it. */ if (p->set_ramdac(p,r,1)) { ! debug2((errout,"Failed to set VideoLUT")); return 1; } return 0; --- 1923,1941 ---- sc = ucmm_user; if ((ev = ucmm_install_monitor_profile(sc, p->edid, p->edid_len, p->name, fname)) != ucmm_ok) { ! debugr2((errout,"Installing profile '%s' failed with error %d '%s'\n",fname,ev,ucmm_error_string(ev))); return 1; } if ((rv = set_X11_atom(p, fname)) != 0) { ! debugr2((errout,"Setting X11 atom failed")); return 1; } /* X11 doesn't set the display to the current profile calibration, */ /* so we do it. */ if (p->set_ramdac(p,r,1)) { ! debugr2((errout,"Failed to set VideoLUT")); return 1; } return 0; *************** *** 1886,1911 **** WCS_PROFILE_MANAGEMENT_SCOPE wcssc; unsigned short *wbname, *wmonid; ! debug2((errout,"Uninstalling '%s'\n", fname)); if (GetColorDirectory(NULL, colpath, &colpathlen) == 0) { ! debug2((errout,"Getting color directory failed\n")); return 1; } if ((fullpath = _fullpath(NULL, fname, 0)) == NULL) { ! debug2((errout,"_fullpath() failed\n")); return 1; } if ((basename = PathFindFileName(fullpath)) == NULL) { ! debug2((errout,"Locating base name in '%s' failed\n",fname)); free(fullpath); return 1; } if ((strlen(colpath) + strlen(basename) + 2) > MAX_PATH) { ! debug2((errout,"Installed profile path too long\n")); free(fullpath); return 1; } --- 1959,1984 ---- WCS_PROFILE_MANAGEMENT_SCOPE wcssc; unsigned short *wbname, *wmonid; ! debugr2((errout,"Uninstalling '%s'\n", fname)); if (GetColorDirectory(NULL, colpath, &colpathlen) == 0) { ! debugr2((errout,"Getting color directory failed\n")); return 1; } if ((fullpath = _fullpath(NULL, fname, 0)) == NULL) { ! debugr2((errout,"_fullpath() failed\n")); return 1; } if ((basename = PathFindFileName(fullpath)) == NULL) { ! debugr2((errout,"Locating base name in '%s' failed\n",fname)); free(fullpath); return 1; } if ((strlen(colpath) + strlen(basename) + 2) > MAX_PATH) { ! debugr2((errout,"Installed profile path too long\n")); free(fullpath); return 1; } *************** *** 1919,1944 **** wcssc = WCS_PROFILE_MANAGEMENT_SCOPE_CURRENT_USER; if ((wbname = char2wchar(basename)) == NULL) { ! debug2((errout,"char2wchar failed\n")); free(fullpath); return 1; } if ((wmonid = char2wchar(p->monid)) == NULL ) { ! debug2((errout,"char2wchar failed\n")); free(wbname); free(fullpath); return 1; } ! debug2((errout,"Disassociating '%s' from '%s'\n",basename,p->monid)); if (pWcsDisassociateColorProfileFromDevice != NULL) { ! debug("Using Vista Disassociate\n"); /* Ignore error if profile is already disasociated or doesn't exist */ if ((*pWcsDisassociateColorProfileFromDevice)(wcssc, wbname, wmonid) == 0 && GetLastError() != 2015 && GetLastError() != 2011) { ! debug2((errout,"WcsDisassociateColorProfileWithDevice() failed for file '%s' with error %d\n",basename,GetLastError())); free(wmonid); free(wbname); free(fullpath); --- 1992,2017 ---- wcssc = WCS_PROFILE_MANAGEMENT_SCOPE_CURRENT_USER; if ((wbname = char2wchar(basename)) == NULL) { ! debugr2((errout,"char2wchar failed\n")); free(fullpath); return 1; } if ((wmonid = char2wchar(p->monid)) == NULL ) { ! debugr2((errout,"char2wchar failed\n")); free(wbname); free(fullpath); return 1; } ! debugr2((errout,"Disassociating '%s' from '%s'\n",basename,p->monid)); if (pWcsDisassociateColorProfileFromDevice != NULL) { ! debugr("Using Vista Disassociate\n"); /* Ignore error if profile is already disasociated or doesn't exist */ if ((*pWcsDisassociateColorProfileFromDevice)(wcssc, wbname, wmonid) == 0 && GetLastError() != 2015 && GetLastError() != 2011) { ! debugr2((errout,"WcsDisassociateColorProfileWithDevice() failed for file '%s' with error %d\n",basename,GetLastError())); free(wmonid); free(wbname); free(fullpath); *************** *** 1948,1954 **** /* Ignore error if profile is already disasociated or doesn't exist */ if (DisassociateColorProfileFromDevice(NULL, basename, p->monid) == 0 && GetLastError() != 2015 && GetLastError() != 2011) { ! debug2((errout,"DisassociateColorProfileWithDevice() failed for file '%s' with error %d\n",basename,GetLastError())); free(wmonid); free(wbname); free(fullpath); --- 2021,2027 ---- /* Ignore error if profile is already disasociated or doesn't exist */ if (DisassociateColorProfileFromDevice(NULL, basename, p->monid) == 0 && GetLastError() != 2015 && GetLastError() != 2011) { ! debugr2((errout,"DisassociateColorProfileWithDevice() failed for file '%s' with error %d\n",basename,GetLastError())); free(wmonid); free(wbname); free(fullpath); *************** *** 1958,1967 **** if (UninstallColorProfile(NULL, basename, TRUE) == 0) { int ev; ! debug2((errout,"Warning, uninstallColorProfile() failed for file '%s' with error %d\n", basename,GetLastError())); /* Hmm. This seems to happen on Win2K. Force the issue. */ if ((ev = _unlink(colpath)) != 0) { ! debug2((errout,"unlink() failed for file '%s' with error %d\n", colpath,errno)); free(wmonid); free(wbname); free(fullpath); --- 2031,2040 ---- if (UninstallColorProfile(NULL, basename, TRUE) == 0) { int ev; ! debugr2((errout,"Warning, uninstallColorProfile() failed for file '%s' with error %d\n", basename,GetLastError())); /* Hmm. This seems to happen on Win2K. Force the issue. */ if ((ev = _unlink(colpath)) != 0) { ! debugr2((errout,"unlink() failed for file '%s' with error %d\n", colpath,errno)); free(wmonid); free(wbname); free(fullpath); *************** *** 1997,2009 **** /* Locate the appropriate ColorSync path */ if ((ev = FSFindFolder(vref, kColorSyncProfilesFolderType, kCreateFolder, &dirref)) != noErr) { ! debug2((errout,"FSFindFolder() failed with error %d\n",ev)); return 1; } /* Convert to POSIX path */ if ((ev = FSRefMakePath(&dirref, (unsigned char *)dpath, FILENAME_MAX)) != noErr) { ! debug2((errout,"FSRefMakePath failed with error %d\n",ev)); return 1; } --- 2070,2082 ---- /* Locate the appropriate ColorSync path */ if ((ev = FSFindFolder(vref, kColorSyncProfilesFolderType, kCreateFolder, &dirref)) != noErr) { ! debugr2((errout,"FSFindFolder() failed with error %d\n",ev)); return 1; } /* Convert to POSIX path */ if ((ev = FSRefMakePath(&dirref, (unsigned char *)dpath, FILENAME_MAX)) != noErr) { ! debugr2((errout,"FSRefMakePath failed with error %d\n",ev)); return 1; } *************** *** 2016,2034 **** /* Append the basename to the ColorSync directory path */ if ((strlen(dpath) + strlen(basename) + 2) > FILENAME_MAX || (strlen(dpath) + strlen(basename) + 2) > 256) { ! debug2((errout,"ColorSync dir + profile name too long\n")); return 1; } strcat(dpath, "/"); strcat(dpath, basename); ! debug2((errout,"Profile to delete '%s'\n",dpath)); if (stat(dpath,&sbuf) != 0) { ! debug2((errout,"delete '%s' profile doesn't exist\n",dpath)); return 2; } if ((ev = unlink(dpath)) != 0) { ! debug2((errout,"delete '%s' failed with %d\n",dpath,ev)); return 1; } --- 2089,2107 ---- /* Append the basename to the ColorSync directory path */ if ((strlen(dpath) + strlen(basename) + 2) > FILENAME_MAX || (strlen(dpath) + strlen(basename) + 2) > 256) { ! debugr2((errout,"ColorSync dir + profile name too long\n")); return 1; } strcat(dpath, "/"); strcat(dpath, basename); ! debugr2((errout,"Profile to delete '%s'\n",dpath)); if (stat(dpath,&sbuf) != 0) { ! debugr2((errout,"delete '%s' profile doesn't exist\n",dpath)); return 2; } if ((ev = unlink(dpath)) != 0) { ! debugr2((errout,"delete '%s' failed with %d\n",dpath,ev)); return 1; } *************** *** 2049,2055 **** sc = ucmm_user; if ((ev = ucmm_uninstall_monitor_profile(sc, p->edid, p->edid_len, p->name, fname)) != ucmm_ok) { ! debug2((errout,"Installing profile '%s' failed with error %d\n",fname,ev)); return 1; } --- 2122,2128 ---- sc = ucmm_user; if ((ev = ucmm_uninstall_monitor_profile(sc, p->edid, p->edid_len, p->name, fname)) != ucmm_ok) { ! debugr2((errout,"Installing profile '%s' failed with error %d '%s'\n",fname,ev,ucmm_error_string(ev))); return 1; } *************** *** 2080,2092 **** DWORD blen = MAX_PATH; if (GetICMProfile(p->hdc, &blen, buf) == 0) { ! debug2((errout, "GetICMProfile failed, lasterr = %d\n",GetLastError())); return NULL; } ! debug2((errout,"Loading default profile '%s'\n",buf)); if ((rd_fp = new_icmFileStd_name(buf,"r")) == NULL) ! debug2((errout,"Can't open file '%s'",buf)); return rd_fp; } --- 2153,2165 ---- DWORD blen = MAX_PATH; if (GetICMProfile(p->hdc, &blen, buf) == 0) { ! debugr2((errout, "GetICMProfile failed, lasterr = %d\n",GetLastError())); return NULL; } ! debugr2((errout,"Loading default profile '%s'\n",buf)); if ((rd_fp = new_icmFileStd_name(buf,"r")) == NULL) ! debugr2((errout,"Can't open file '%s'",buf)); return rd_fp; } *************** *** 2103,2109 **** #ifdef NEVER /* Get the current display profile */ if ((ev = CMGetProfileByAVID((CMDisplayIDType)p->ddid, &prof)) != noErr) { ! debug2((errout,"CMGetProfileByAVID() failed with error %d\n",ev)); return NULL; } #else --- 2176,2182 ---- #ifdef NEVER /* Get the current display profile */ if ((ev = CMGetProfileByAVID((CMDisplayIDType)p->ddid, &prof)) != noErr) { ! debugr2((errout,"CMGetProfileByAVID() failed with error %d\n",ev)); return NULL; } #else *************** *** 2112,2136 **** /* Get the default ID for the display */ if ((ev = CMGetDeviceDefaultProfileID(cmDisplayDeviceClass, (CMDeviceID)p->ddid, &curID)) != noErr) { ! debug2((errout,"CMGetDeviceDefaultProfileID() failed with error %d\n",ev)); return NULL; } /* Get the displays profile */ if ((ev = CMGetDeviceProfile(cmDisplayDeviceClass, (CMDeviceID)p->ddid, curID, &cploc)) != noErr) { ! debug2((errout,"CMGetDeviceDefaultProfileID() failed with error %d\n",ev)); return NULL; } if ((ev = CMOpenProfile(&prof, &cploc)) != noErr) { ! debug2((errout,"CMOpenProfile() failed with error %d\n",ev)); return NULL; } #endif /* Get the profile size */ if ((ev = CMGetProfileHeader(prof, &hdr)) != noErr) { ! debug2((errout,"CMGetProfileHeader() failed with error %d\n",ev)); return NULL; } --- 2185,2209 ---- /* Get the default ID for the display */ if ((ev = CMGetDeviceDefaultProfileID(cmDisplayDeviceClass, (CMDeviceID)p->ddid, &curID)) != noErr) { ! debugr2((errout,"CMGetDeviceDefaultProfileID() failed with error %d\n",ev)); return NULL; } /* Get the displays profile */ if ((ev = CMGetDeviceProfile(cmDisplayDeviceClass, (CMDeviceID)p->ddid, curID, &cploc)) != noErr) { ! debugr2((errout,"CMGetDeviceDefaultProfileID() failed with error %d\n",ev)); return NULL; } if ((ev = CMOpenProfile(&prof, &cploc)) != noErr) { ! debugr2((errout,"CMOpenProfile() failed with error %d\n",ev)); return NULL; } #endif /* Get the profile size */ if ((ev = CMGetProfileHeader(prof, &hdr)) != noErr) { ! debugr2((errout,"CMGetProfileHeader() failed with error %d\n",ev)); return NULL; } *************** *** 2138,2159 **** dploc.locType = cmBufferBasedProfile; dploc.u.bufferLoc.size = hdr.cm1.size; if ((al = new_icmAllocStd()) == NULL) { ! debug("new_icmAllocStd failed\n"); return NULL; } if ((dploc.u.bufferLoc.buffer = al->malloc(al, dploc.u.bufferLoc.size)) == NULL) { ! debug("malloc of profile buffer failed\n"); return NULL; } if ((ev = CMCopyProfile(&dprof, &dploc, prof)) != noErr) { ! debug2((errout,"CMCopyProfile() failed for AVID to buffer with error %d\n",ev)); return NULL; } /* Memory File fp that will free the buffer when deleted: */ if ((rd_fp = new_icmFileMem_ad((void *)dploc.u.bufferLoc.buffer, dploc.u.bufferLoc.size, al)) == NULL) { ! debug("Creating memory file from CMProfileLocation failed"); al->free(al, dploc.u.bufferLoc.buffer); al->del(al); CMCloseProfile(prof); --- 2211,2232 ---- dploc.locType = cmBufferBasedProfile; dploc.u.bufferLoc.size = hdr.cm1.size; if ((al = new_icmAllocStd()) == NULL) { ! debugr("new_icmAllocStd failed\n"); return NULL; } if ((dploc.u.bufferLoc.buffer = al->malloc(al, dploc.u.bufferLoc.size)) == NULL) { ! debugr("malloc of profile buffer failed\n"); return NULL; } if ((ev = CMCopyProfile(&dprof, &dploc, prof)) != noErr) { ! debugr2((errout,"CMCopyProfile() failed for AVID to buffer with error %d\n",ev)); return NULL; } /* Memory File fp that will free the buffer when deleted: */ if ((rd_fp = new_icmFileMem_ad((void *)dploc.u.bufferLoc.buffer, dploc.u.bufferLoc.size, al)) == NULL) { ! debugr("Creating memory file from CMProfileLocation failed"); al->free(al, dploc.u.bufferLoc.buffer); al->del(al); CMCloseProfile(prof); *************** *** 2179,2213 **** ucmm_error ev; char *profile = NULL; ! debug2((errout,"dispwin_get_profile called\n")); ! if ((ev = ucmm_get_monitor_profile(p->edid, p->edid_len, p->name, &profile)) == ucmm_ok) { if (name != NULL) { strncpy(name, profile, mxlen); name[mxlen] = '\000'; } ! debug2((errout,"Loading current profile '%s'\n",profile)); if ((rd_fp = new_icmFileStd_name(profile,"r")) == NULL) { ! debug2((errout,"Can't open file '%s'",profile)); free(profile); return NULL; } /* Implicitly we set the X11 atom to be the profile we just got */ ! debug2((errout,"Setting X11 atom to current profile '%s'\n",profile)); if (set_X11_atom(p, profile) != 0) { ! debug2((errout,"Setting X11 atom to profile '%s' failed",profile)); /* Hmm. We ignore this error */ } return rd_fp; } if (ev != ucmm_no_profile) { ! debug2((errout,"Got ucmm error %d\n",ev)); return NULL; } ! debug2((errout,"Failed to get configured profile, so use X11 atom\n")); /* Drop through to using the X11 root window atom */ } { --- 2252,2286 ---- ucmm_error ev; char *profile = NULL; ! debugr2((errout,"dispwin_get_profile called\n")); ! if ((ev = ucmm_get_monitor_profile(p->edid, p->edid_len, p->name, &profile)) == ucmm_ok) { if (name != NULL) { strncpy(name, profile, mxlen); name[mxlen] = '\000'; } ! debugr2((errout,"Loading current profile '%s'\n",profile)); if ((rd_fp = new_icmFileStd_name(profile,"r")) == NULL) { ! debugr2((errout,"Can't open file '%s'",profile)); free(profile); return NULL; } /* Implicitly we set the X11 atom to be the profile we just got */ ! debugr2((errout,"Setting X11 atom to current profile '%s'\n",profile)); if (set_X11_atom(p, profile) != 0) { ! debugr2((errout,"Setting X11 atom to profile '%s' failed",profile)); /* Hmm. We ignore this error */ } return rd_fp; } if (ev != ucmm_no_profile) { ! debugr2((errout,"Got ucmm error %d '%s'\n",ev,ucmm_error_string(ev))); return NULL; } ! debugr2((errout,"Failed to get configured profile, so use X11 atom\n")); /* Drop through to using the X11 root window atom */ } { *************** *** 2231,2237 **** if (XRRGetOutputProperty(p->mydisplay, p->output, p->icc_out_atom, 0, 0x7ffffff, False, False, XA_CARDINAL, &ret_type, &ret_format, &ret_len, &ret_togo, &atomv) != Success || ret_len == 0) { ! debug("Failed to read ICC_PROFILE property from Xranr output\n"); } } --- 2304,2310 ---- if (XRRGetOutputProperty(p->mydisplay, p->output, p->icc_out_atom, 0, 0x7ffffff, False, False, XA_CARDINAL, &ret_type, &ret_format, &ret_len, &ret_togo, &atomv) != Success || ret_len == 0) { ! debugr("Failed to read ICC_PROFILE property from Xranr output\n"); } } *************** *** 2245,2251 **** if (XGetWindowProperty(p->mydisplay, RootWindow(p->mydisplay, 0), p->icc_atom, 0, 0x7ffffff, False, XA_CARDINAL, &ret_type, &ret_format, &ret_len, &ret_togo, &atomv) != Success || ret_len == 0) { ! debug2((errout,"Getting property '%s' from RootWindow\n", aname)); return NULL; } } --- 2318,2324 ---- if (XGetWindowProperty(p->mydisplay, RootWindow(p->mydisplay, 0), p->icc_atom, 0, 0x7ffffff, False, XA_CARDINAL, &ret_type, &ret_format, &ret_len, &ret_togo, &atomv) != Success || ret_len == 0) { ! debugr2((errout,"Getting property '%s' from RootWindow\n", aname)); return NULL; } } *************** *** 2254,2264 **** /* straight. (We can't assume that X11 and icc are using the */ /* same allocators) */ if ((al = new_icmAllocStd()) == NULL) { ! debug("new_icmAllocStd failed\n"); return NULL; } if ((buf = al->malloc(al, ret_len)) == NULL) { ! debug("malloc of profile buffer failed\n"); return NULL; } memcpy(buf, atomv, ret_len); --- 2327,2337 ---- /* straight. (We can't assume that X11 and icc are using the */ /* same allocators) */ if ((al = new_icmAllocStd()) == NULL) { ! debugr("new_icmAllocStd failed\n"); return NULL; } if ((buf = al->malloc(al, ret_len)) == NULL) { ! debugr("malloc of profile buffer failed\n"); return NULL; } memcpy(buf, atomv, ret_len); *************** *** 2266,2272 **** /* Memory File fp that will free the buffer when deleted: */ if ((rd_fp = new_icmFileMem_ad((void *)buf, ret_len, al)) == NULL) { ! debug("Creating memory file from X11 atom failed"); al->free(al, buf); al->del(al); return NULL; --- 2339,2345 ---- /* Memory File fp that will free the buffer when deleted: */ if ((rd_fp = new_icmFileMem_ad((void *)buf, ret_len, al)) == NULL) { ! debugr("Creating memory file from X11 atom failed"); al->free(al, buf); al->del(al); return NULL; *************** *** 2355,2361 **** ) { int j; ! debug("dispwin_set_color called\n"); if (p->nowin) return 1; --- 2428,2434 ---- ) { int j; ! debugr("dispwin_set_color called\n"); if (p->nowin) return 1; *************** *** 2385,2391 **** //printf(" cell[%d], val %f, rast val %f\n",tt, p->rgb[j], p->r_rgb[j]); } if (p->set_ramdac(p,p->r, 0)) { ! debug("set_ramdac() failed\n"); return 1; } } --- 2458,2464 ---- //printf(" cell[%d], val %f, rast val %f\n",tt, p->rgb[j], p->r_rgb[j]); } if (p->set_ramdac(p,p->r, 0)) { ! debugr("set_ramdac() failed\n"); return 1; } } *************** *** 2405,2417 **** SetThreadExecutionState(ES_DISPLAY_REQUIRED); if ((regn = CreateRectRgn(p->tx, p->ty, p->tx + p->tw, p->ty + p->th)) == NULL) { ! debug2((errout,"CreateRectRgn failed, lasterr = %d\n",GetLastError())); return 1; } /* Force a repaint with the new data */ if (!InvalidateRgn(p->hwnd,regn,TRUE)) { ! debug2((errout,"InvalidateRgn failed, lasterr = %d\n",GetLastError())); return 1; } --- 2478,2490 ---- SetThreadExecutionState(ES_DISPLAY_REQUIRED); if ((regn = CreateRectRgn(p->tx, p->ty, p->tx + p->tw, p->ty + p->th)) == NULL) { ! debugr2((errout,"CreateRectRgn failed, lasterr = %d\n",GetLastError())); return 1; } /* Force a repaint with the new data */ if (!InvalidateRgn(p->hwnd,regn,TRUE)) { ! debugr2((errout,"InvalidateRgn failed, lasterr = %d\n",GetLastError())); return 1; } *************** *** 2467,2481 **** OSStatus stat; ProcessSerialNumber cpsn; if ((stat = GetCurrentProcess(&cpsn)) != noErr) { ! debug2((errout,"GetCurrentProcess returned error %d\n",stat)); } else { #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 if ((stat = TransformProcessType(&cpsn, kProcessTransformToForegroundApplication)) != noErr) { ! debug2((errout,"TransformProcessType returned error %d\n",stat)); } #endif /* OS X 10.3 */ if ((stat = SetFrontProcess(&cpsn)) != noErr) { ! debug2((errout,"SetFrontProcess returned error %d\n",stat)); } } /* Hide the cursor once too */ --- 2540,2554 ---- OSStatus stat; ProcessSerialNumber cpsn; if ((stat = GetCurrentProcess(&cpsn)) != noErr) { ! debugr2((errout,"GetCurrentProcess returned error %d\n",stat)); } else { #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 if ((stat = TransformProcessType(&cpsn, kProcessTransformToForegroundApplication)) != noErr) { ! debugr2((errout,"TransformProcessType returned error %d\n",stat)); } #endif /* OS X 10.3 */ if ((stat = SetFrontProcess(&cpsn)) != noErr) { ! debugr2((errout,"SetFrontProcess returned error %d\n",stat)); } } /* Hide the cursor once too */ *************** *** 2556,2562 **** dispwin *p, char *callout ) { ! debug2((errout,"dispwin_set_callout called with '%s'\n",callout)); p->callout = strdup(callout); } --- 2629,2635 ---- dispwin *p, char *callout ) { ! debugr2((errout,"dispwin_set_callout called with '%s'\n",callout)); p->callout = strdup(callout); } *************** *** 2567,2573 **** dispwin *p ) { ! debug("dispwin_del called\n"); if (p == NULL) return; --- 2640,2646 ---- dispwin *p ) { ! debugr("dispwin_del called\n"); if (p == NULL) return; *************** *** 2580,2593 **** p->set_ramdac(p, p->or, 0); p->or->del(p->or); p->r->del(p->r); ! debug("Restored original ramdac\n"); } /* -------------------------------------------------- */ #ifdef NT if (p->hwnd != NULL) { if (!DestroyWindow(p->hwnd)) { ! debug2((errout, "DestroyWindow failed, lasterr = %d\n",GetLastError())); } // DestroyCursor(p->curs); } --- 2653,2666 ---- p->set_ramdac(p, p->or, 0); p->or->del(p->or); p->r->del(p->r); ! debugr("Restored original ramdac\n"); } /* -------------------------------------------------- */ #ifdef NT if (p->hwnd != NULL) { if (!DestroyWindow(p->hwnd)) { ! debugr2((errout, "DestroyWindow failed, lasterr = %d\n",GetLastError())); } // DestroyCursor(p->curs); } *************** *** 2616,2622 **** /* -------------------------------------------------- */ #if defined(UNIX) && !defined(__APPLE__) ! debug("About to close display\n"); if (p->mydisplay != NULL) { if (p->nowin == 0) { /* We have a window up */ --- 2689,2695 ---- /* -------------------------------------------------- */ #if defined(UNIX) && !defined(__APPLE__) ! debugr("About to close display\n"); if (p->mydisplay != NULL) { if (p->nowin == 0) { /* We have a window up */ *************** *** 2628,2634 **** } XCloseDisplay(p->mydisplay); } ! debug("finished\n"); #endif /* UNXI X11 */ /* -------------------------------------------------- */ --- 2701,2707 ---- } XCloseDisplay(p->mydisplay); } ! debugr("finished\n"); #endif /* UNXI X11 */ /* -------------------------------------------------- */ *************** *** 2701,2707 **** int nowin, /* NZ if no window should be created - RAMDAC access only */ int native, /* NZ if ramdac should be bypassed rather than used. */ int blackbg, /* NZ if whole screen should be filled with black */ ! int override /* NZ if override_redirect is to be used on X11 */ ) { dispwin *p = NULL; --- 2774,2781 ---- int nowin, /* NZ if no window should be created - RAMDAC access only */ int native, /* NZ if ramdac should be bypassed rather than used. */ int blackbg, /* NZ if whole screen should be filled with black */ ! int override, /* NZ if override_redirect is to be used on X11 */ ! int ddebug /* >0 to print debug statements to stderr */ ) { dispwin *p = NULL; *************** *** 2713,2718 **** --- 2787,2793 ---- p->nowin = nowin; p->donat = native; p->blackbg = blackbg; + p->ddebug = ddebug; p->get_ramdac = dispwin_get_ramdac; p->set_ramdac = dispwin_set_ramdac; p->install_profile = dispwin_install_profile; *************** *** 2739,2756 **** p->AppName = "Argyll Test Window"; ! debug2((errout, "About to open display '%s'\n",disp->name)); /* Get device context to main display */ /* (This is the recommended way of doing this, and works on Vista) */ if ((p->hdc = CreateDC(disp->name, NULL, NULL, NULL)) == NULL) { ! debug2((errout, "CreateDC failed, lasterr = %d\n",GetLastError())); dispwin_del(p); return NULL; } if ((p->name = strdup(disp->name)) == NULL) { ! debug2((errout, "Malloc failed\n")); dispwin_del(p); return NULL; } --- 2814,2831 ---- p->AppName = "Argyll Test Window"; ! debugr2((errout, "About to open display '%s'\n",disp->name)); /* Get device context to main display */ /* (This is the recommended way of doing this, and works on Vista) */ if ((p->hdc = CreateDC(disp->name, NULL, NULL, NULL)) == NULL) { ! debugr2((errout, "CreateDC failed, lasterr = %d\n",GetLastError())); dispwin_del(p); return NULL; } if ((p->name = strdup(disp->name)) == NULL) { ! debugr2((errout, "Malloc failed\n")); dispwin_del(p); return NULL; } *************** *** 2820,2826 **** ShowCursor(FALSE); if ((p->arv = RegisterClass(&wc)) == 0) { ! debug2((errout, "RegisterClass failed, lasterr = %d\n",GetLastError())); dispwin_del(p); return NULL; } --- 2895,2901 ---- ShowCursor(FALSE); if ((p->arv = RegisterClass(&wc)) == 0) { ! debugr2((errout, "RegisterClass failed, lasterr = %d\n",GetLastError())); dispwin_del(p); return NULL; } *************** *** 2838,2844 **** NULL); /* pointer to window creation data */ if (!p->hwnd) { ! debug2((errout, "CreateWindow failed, lasterr = %d\n",GetLastError())); dispwin_del(p); return NULL; } --- 2913,2919 ---- NULL); /* pointer to window creation data */ if (!p->hwnd) { ! debugr2((errout, "CreateWindow failed, lasterr = %d\n",GetLastError())); dispwin_del(p); return NULL; } *************** *** 2868,2874 **** #ifdef __APPLE__ if ((p->name = strdup(disp->name)) == NULL) { ! debug2((errout,"Malloc failed\n")); dispwin_del(p); return NULL; } --- 2943,2949 ---- #ifdef __APPLE__ if ((p->name = strdup(disp->name)) == NULL) { ! debugr2((errout,"Malloc failed\n")); dispwin_del(p); return NULL; } *************** *** 2911,2917 **** attr |= kWindowIgnoreClicksAttribute; /* usual */ sz = CGDisplayScreenSize(p->ddid); ! debug2((errout," Display size = %f x %f mm\n",sz.width,sz.height)); wi = (int)(width * disp->sw/sz.width + 0.5); if (wi > disp->sw) --- 2986,2992 ---- attr |= kWindowIgnoreClicksAttribute; /* usual */ sz = CGDisplayScreenSize(p->ddid); ! debugr2((errout," Display size = %f x %f mm\n",sz.width,sz.height)); wi = (int)(width * disp->sw/sz.width + 0.5); if (wi > disp->sw) *************** *** 2949,2955 **** /* Create invisible new window of given class, attributes and size */ stat = CreateNewWindow(wclass, attr, &wRect, &p->mywindow); if (stat != noErr || p->mywindow == nil) { ! debug2((errout,"CreateNewWindow failed with code %d\n",stat)); dispwin_del(p); return NULL; } --- 3024,3030 ---- /* Create invisible new window of given class, attributes and size */ stat = CreateNewWindow(wclass, attr, &wRect, &p->mywindow); if (stat != noErr || p->mywindow == nil) { ! debugr2((errout,"CreateNewWindow failed with code %d\n",stat)); dispwin_del(p); return NULL; } *************** *** 2973,2979 **** &fHandler /* Event handler reference return value */ ); if (stat != noErr) { ! debug2((errout,"InstallEventHandler failed with code %d\n",stat)); dispwin_del(p); return NULL; } --- 3048,3054 ---- &fHandler /* Event handler reference return value */ ); if (stat != noErr) { ! debugr2((errout,"InstallEventHandler failed with code %d\n",stat)); dispwin_del(p); return NULL; } *************** *** 2982,2988 **** p->port = GetWindowPort(p->mywindow); if ((stat = QDBeginCGContext(p->port, &p->mygc)) != noErr) { ! debug2((errout,"QDBeginCGContext returned error %d\n",stat)); dispwin_del(p); return NULL; } --- 3057,3063 ---- p->port = GetWindowPort(p->mywindow); if ((stat = QDBeginCGContext(p->port, &p->mygc)) != noErr) { ! debugr2((errout,"QDBeginCGContext returned error %d\n",stat)); dispwin_del(p); return NULL; } *************** *** 3084,3090 **** */ if(ssdispwin != NULL) { ! debug2((errout,"Attempting to open more than one dispwin!\n")); dispwin_del(p); return NULL; } --- 3159,3165 ---- */ if(ssdispwin != NULL) { ! debugr2((errout,"Attempting to open more than one dispwin!\n")); dispwin_del(p); return NULL; } *************** *** 3108,3114 **** /* Create the base display name (in case of Xinerama, XRandR) */ if ((bname = strdup(disp->name)) == NULL) { ! debug2((errout,"Malloc failed\n")); dispwin_del(p); return NULL; } --- 3183,3189 ---- /* Create the base display name (in case of Xinerama, XRandR) */ if ((bname = strdup(disp->name)) == NULL) { ! debugr2((errout,"Malloc failed\n")); dispwin_del(p); return NULL; } *************** *** 3121,3136 **** /* open the display */ p->mydisplay = XOpenDisplay(bname); if(!p->mydisplay) { ! debug2((errout,"Unable to open display '%s'\n",bname)); dispwin_del(p); free(bname); return NULL; } free(bname); ! debug("Opened display OK\n"); if ((p->name = strdup(disp->name)) == NULL) { ! debug2((errout,"Malloc failed\n")); dispwin_del(p); return NULL; } --- 3196,3211 ---- /* open the display */ p->mydisplay = XOpenDisplay(bname); if(!p->mydisplay) { ! debugr2((errout,"Unable to open display '%s'\n",bname)); dispwin_del(p); free(bname); return NULL; } free(bname); ! debugr("Opened display OK\n"); if ((p->name = strdup(disp->name)) == NULL) { ! debugr2((errout,"Malloc failed\n")); dispwin_del(p); return NULL; } *************** *** 3147,3153 **** if (disp->edid != NULL) { if ((p->edid = malloc(sizeof(unsigned char) * 128)) == NULL) { ! debug2((errout,"Malloc failed\n")); dispwin_del(p); return NULL; } --- 3222,3228 ---- if (disp->edid != NULL) { if ((p->edid = malloc(sizeof(unsigned char) * 128)) == NULL) { ! debugr2((errout,"Malloc failed\n")); dispwin_del(p); return NULL; } *************** *** 3221,3227 **** else myattr.override_redirect = False; ! debug("Opening window\n"); p->mywindow = XCreateWindow( p->mydisplay, rootwindow, mysizehints.x,mysizehints.y,mysizehints.width,mysizehints.height, --- 3296,3302 ---- else myattr.override_redirect = False; ! debugr("Opening window\n"); p->mywindow = XCreateWindow( p->mydisplay, rootwindow, mysizehints.x,mysizehints.y,mysizehints.width,mysizehints.height, *************** *** 3241,3247 **** if (XGetWindowAttributes( p->mydisplay, p->mywindow, &mywattributes) == 0) { ! debug("XGetWindowAttributes failed\n"); dispwin_del(p); return NULL; } --- 3316,3322 ---- if (XGetWindowAttributes( p->mydisplay, p->mywindow, &mywattributes) == 0) { ! debugr("XGetWindowAttributes failed\n"); dispwin_del(p); return NULL; } *************** *** 3437,3443 **** /* Process to continuously monitor XRandR events, */ /* and load the appropriate calibration and profiles */ /* for each monitor. */ ! int x11_daemon_mode(disppath *disp, int verb) { #if RANDR_MAJOR == 1 && RANDR_MINOR >= 2 && !defined(DISABLE_RANDR) char *dname; --- 3512,3518 ---- /* Process to continuously monitor XRandR events, */ /* and load the appropriate calibration and profiles */ /* for each monitor. */ ! int x11_daemon_mode(disppath *disp, int verb, int ddebug) { #if RANDR_MAJOR == 1 && RANDR_MINOR >= 2 && !defined(DISABLE_RANDR) char *dname; *************** *** 3475,3482 **** /* !!!! we want to create a test here, to see if we have to poll, */ /* !!!! or whether we spontainously get events when the EDID changes. */ ! /* Use Xrandr 1.2 if it's available */ ! if (XRRQueryExtension(mydisplay, &evb, &erb) != 0 && XRRQueryVersion(mydisplay, &majv, &minv) && majv == 1 && minv >= 2) { if (verb) printf("Found XRandR 1.2 or latter\n"); --- 3550,3558 ---- /* !!!! we want to create a test here, to see if we have to poll, */ /* !!!! or whether we spontainously get events when the EDID changes. */ ! /* Use Xrandr 1.2 if it's available and not disabled */ ! if (getenv("ARGYLL_IGNORE_XRANDR1_2") == NULL ! && XRRQueryExtension(mydisplay, &evb, &erb) != 0 && XRRQueryVersion(mydisplay, &majv, &minv) && majv == 1 && minv >= 2) { if (verb) printf("Found XRandR 1.2 or latter\n"); *************** *** 3551,3557 **** break; if (verb) printf("Updating display %d = '%s'\n",i+1,dp[i]->description); ! if ((dw = new_dispwin(dp[i], 0.0, 0.0, 0.0, 0.0, 1, 0, 0, 0)) == NULL) { if (verb) printf("Failed to access screen %d of display '%s'\n",i+1,dnbuf); continue; } --- 3627,3633 ---- break; if (verb) printf("Updating display %d = '%s'\n",i+1,dp[i]->description); ! if ((dw = new_dispwin(dp[i], 0.0, 0.0, 0.0, 0.0, 1, 0, 0, 0, ddebug)) == NULL) { if (verb) printf("Failed to access screen %d of display '%s'\n",i+1,dnbuf); continue; } *************** *** 3698,3703 **** --- 3774,3780 ---- #if defined(UNIX) && !defined(__APPLE__) fprintf(stderr," -D Run in daemon loader mode for given X11 server\n"); #endif /* X11 */ + fprintf(stderr," -E [level] Print debug diagnostics to stderr\n"); fprintf(stderr," calfile Load calibration (.cal or %s) into Video LUT\n",ICC_FILE_EXT); exit(1); } *************** *** 3710,3715 **** --- 3787,3793 ---- main(int argc, char *argv[]) { int fa, nfa, mfa; /* current argument we're looking at */ int verb = 0; /* Verbose flag */ + int ddebug = 0; /* debug level */ disppath *disp = NULL; /* Display being used */ double patscale = 1.0; /* scale factor for test patch size */ double ho = 0.0, vo = 0.0; /* Test window offsets, -1.0 to 1.0 */ *************** *** 3761,3766 **** --- 3839,3854 ---- else if (argv[fa][1] == 'v') verb = 1; + /* Debug */ + else if (argv[fa][1] == 'E') { + ddebug = 1; + if (na != NULL && na[0] >= '0' && na[0] <= '9') { + ddebug = atoi(na); + fa = nfa; + } + callback_ddebug = 1; /* dispwin global */ + } + /* Display number */ else if (argv[fa][1] == 'd') { #if defined(UNIX) && !defined(__APPLE__) *************** *** 3897,3903 **** #if defined(UNIX) && !defined(__APPLE__) if (daemonmode) { ! return x11_daemon_mode(disp, verb); } #endif --- 3985,3991 ---- #if defined(UNIX) && !defined(__APPLE__) if (daemonmode) { ! return x11_daemon_mode(disp, verb, ddebug); } #endif *************** *** 3921,3927 **** if (verb) printf("About to open dispwin object on the display\n"); ! if ((dw = new_dispwin(disp, 100.0 * patscale, 100.0 * patscale, ho, vo, nowin, donat, blackbg, 1)) == NULL) { printf("Error - new_dispwin failed!\n"); return -1; } --- 4009,4015 ---- if (verb) printf("About to open dispwin object on the display\n"); ! if ((dw = new_dispwin(disp, 100.0 * patscale, 100.0 * patscale, ho, vo, nowin, donat, blackbg, 1, ddebug)) == NULL) { printf("Error - new_dispwin failed!\n"); return -1; } diff --strip-trailing-cr -c -r Argyll_V1.0.0/spectro/dispwin.h Argyll_V1.0.1/spectro/dispwin.h *** Argyll_V1.0.0/spectro/dispwin.h Mon Jun 30 23:21:21 2008 --- Argyll_V1.0.1/spectro/dispwin.h Wed Jul 9 23:47:51 2008 *************** *** 109,119 **** --- 109,123 ---- void free_disppaths(disppath **paths); + /* Delete the display at the given index from the paths */ + void del_disppath(disppath **paths, int ix); + /* Return the given display given its index 0..n-1 */ disppath *get_a_display(int ix); void free_a_disppath(disppath *path); + extern int callback_ddebug; /* Diagnostic global for get_displays() and get_a_display() */ /* - - - - - - - - - - - - - - - - - - - - - - - */ /* Structure to handle RAMDAC values */ *************** *** 218,223 **** --- 222,229 ---- #endif /* UNIX */ + int ddebug; /* >0 to print debug to stderr */ + /* public: */ int pdepth; /* Plane depth of display */ *************** *** 262,268 **** int nowin, /* NZ if no window should be created - RAMDAC access only */ int native, /* NZ if ramdac should be bypassed instead of being used */ int blackbg, /* NZ if whole screen should be filled with black */ ! int override /* NZ if override_redirect is to be used on X11 */ ); --- 268,275 ---- int nowin, /* NZ if no window should be created - RAMDAC access only */ int native, /* NZ if ramdac should be bypassed instead of being used */ int blackbg, /* NZ if whole screen should be filled with black */ ! int override, /* NZ if override_redirect is to be used on X11 */ ! int ddebug /* >0 to print debug statements to stderr */ ); diff --strip-trailing-cr -c -r Argyll_V1.0.0/spectro/i1pro_imp.c Argyll_V1.0.1/spectro/i1pro_imp.c *** Argyll_V1.0.0/spectro/i1pro_imp.c Mon Jun 30 23:21:20 2008 --- Argyll_V1.0.1/spectro/i1pro_imp.c Wed Jul 9 23:47:50 2008 *************** *** 229,236 **** i1pro_code add_i1proimp(i1pro *p) { i1proimp *m; ! if ((m = (i1proimp *)calloc(1, sizeof(i1proimp))) == NULL) I1PRO_INT_MALLOC; m->p = p; /* EEProm data store */ --- 229,239 ---- i1pro_code add_i1proimp(i1pro *p) { i1proimp *m; ! if ((m = (i1proimp *)calloc(1, sizeof(i1proimp))) == NULL) { ! DBG((dbgo,"add_i1proimp malloc %d bytes failed (1)\n",sizeof(i1proimp))) ! if (p->verb) printf("Malloc %d bytes failed (1)\n",sizeof(i1proimp)); I1PRO_INT_MALLOC; + } m->p = p; /* EEProm data store */ *************** *** 1456,1462 **** if (s->reflective) { bsize = 256 * nummeas; if ((buf = (unsigned char *)malloc(sizeof(unsigned char) * bsize)) == NULL) { ! DBG((dbgo,"i1pro_imp_measure malloc failed\n")) return I1PRO_INT_MALLOC; } } --- 1459,1466 ---- if (s->reflective) { bsize = 256 * nummeas; if ((buf = (unsigned char *)malloc(sizeof(unsigned char) * bsize)) == NULL) { ! DBG((dbgo,"i1pro_imp_measure malloc %d bytes failed (5)\n",bsize)) ! if (p->verb) printf("Malloc %d bytes failed (5)\n",bsize); return I1PRO_INT_MALLOC; } } *************** *** 1469,1475 **** if ((mbuf = (unsigned char *)malloc(sizeof(unsigned char) * mbsize)) == NULL) { if (buf != NULL) free(buf); ! DBG((dbgo,"i1pro_imp_measure malloc failed\n")) return I1PRO_INT_MALLOC; } specrd = dmatrix(0, nvals-1, 0, m->nwav-1); --- 1473,1480 ---- if ((mbuf = (unsigned char *)malloc(sizeof(unsigned char) * mbsize)) == NULL) { if (buf != NULL) free(buf); ! DBG((dbgo,"i1pro_imp_measure malloc %d bytes failed (6)\n",mbsize)) ! if (p->verb) printf("Malloc %d bytes failed (6)\n",mbsize); return I1PRO_INT_MALLOC; } specrd = dmatrix(0, nvals-1, 0, m->nwav-1); *************** *** 1602,1608 **** mbsize = 256 * maxnummeas; if ((mbuf = (unsigned char *)malloc(sizeof(unsigned char) * mbsize)) == NULL) { free_dmatrix(specrd, 0, nvals-1, 0, m->nwav-1); ! DBG((dbgo,"i1pro_imp_measure malloc failed\n")) return I1PRO_INT_MALLOC; } --- 1607,1614 ---- mbsize = 256 * maxnummeas; if ((mbuf = (unsigned char *)malloc(sizeof(unsigned char) * mbsize)) == NULL) { free_dmatrix(specrd, 0, nvals-1, 0, m->nwav-1); ! DBG((dbgo,"i1pro_imp_measure malloc %d bytes failed (7)\n",mbsize)) ! if (p->verb) printf("Malloc %d bytes failed (7)\n",mbsize); return I1PRO_INT_MALLOC; } *************** *** 2506,2513 **** unsigned int bsize; bsize = 256 * nummeas; ! if ((buf = (unsigned char *)malloc(sizeof(unsigned char) * bsize)) == NULL) return I1PRO_INT_MALLOC; if ((ev = i1pro_dark_measure_1(p, nummeas, inttime, gainmode, buf, bsize)) != I1PRO_OK) { free(buf); --- 2512,2522 ---- unsigned int bsize; bsize = 256 * nummeas; ! if ((buf = (unsigned char *)malloc(sizeof(unsigned char) * bsize)) == NULL) { ! DBG((dbgo,"i1pro_dark_measure malloc %d bytes failed (8)\n",bsize)) ! if (p->verb) printf("Malloc %d bytes failed (8)\n",bsize); return I1PRO_INT_MALLOC; + } if ((ev = i1pro_dark_measure_1(p, nummeas, inttime, gainmode, buf, bsize)) != I1PRO_OK) { free(buf); *************** *** 2515,2521 **** } if ((ev = i1pro_dark_measure_2(p, abssens, nummeas, *inttime, gainmode, buf, bsize)) ! != I1PRO_OK) { free(buf); return ev; } --- 2524,2530 ---- } if ((ev = i1pro_dark_measure_2(p, abssens, nummeas, *inttime, gainmode, buf, bsize)) ! != I1PRO_OK) { free(buf); return ev; } *************** *** 2555,2563 **** /* Allocate temporaries */ bsize = 256 * nummeas; ! if ((buf = (unsigned char *)malloc(sizeof(unsigned char) * bsize)) == NULL) return I1PRO_INT_MALLOC; ! DBG((dbgo,"Triggering measurement cycle, nummeas %d, inttime %f, gainmode %d\n", nummeas, *inttime, gainmode)) --- 2564,2574 ---- /* Allocate temporaries */ bsize = 256 * nummeas; ! if ((buf = (unsigned char *)malloc(sizeof(unsigned char) * bsize)) == NULL) { ! DBG((dbgo,"i1pro_whitemeasure malloc %d bytes failed (10)\n",bsize)) ! if (p->verb) printf("Malloc %d bytes failed (10)\n",bsize); return I1PRO_INT_MALLOC; ! } DBG((dbgo,"Triggering measurement cycle, nummeas %d, inttime %f, gainmode %d\n", nummeas, *inttime, gainmode)) *************** *** 2960,2967 **** /* Allocate temporaries */ bsize = 256 * maxnummeas; ! if ((buf = (unsigned char *)malloc(sizeof(unsigned char) * bsize)) == NULL) return I1PRO_INT_MALLOC; /* Trigger measure and gather raw readings */ if ((ev = i1pro_read_patches_1(p, minnummeas, maxnummeas, inttime, gainmode, --- 2971,2981 ---- /* Allocate temporaries */ bsize = 256 * maxnummeas; ! if ((buf = (unsigned char *)malloc(sizeof(unsigned char) * bsize)) == NULL) { ! DBG((dbgo,"i1pro_read_patches malloc %d bytes failed (11)\n",bsize)) ! if (p->verb) printf("Malloc %d bytes failed (11)\n",bsize); return I1PRO_INT_MALLOC; + } /* Trigger measure and gather raw readings */ if ((ev = i1pro_read_patches_1(p, minnummeas, maxnummeas, inttime, gainmode, *************** *** 3012,3019 **** /* Allocate temporaries */ bsize = 256 * nummeas; ! if ((buf = (unsigned char *)malloc(sizeof(unsigned char) * bsize)) == NULL) return I1PRO_INT_MALLOC; multimes = dmatrix(0, nummeas-1, 0, m->nraw-1); abssens = dvector(0, m->nraw-1); --- 3026,3036 ---- /* Allocate temporaries */ bsize = 256 * nummeas; ! if ((buf = (unsigned char *)malloc(sizeof(unsigned char) * bsize)) == NULL) { ! DBG((dbgo,"i1pro_trialmeasure malloc %d bytes failed (12)\n",bsize)) ! if (p->verb) printf("Malloc %d bytes failed (12)\n",bsize); return I1PRO_INT_MALLOC; + } multimes = dmatrix(0, nummeas-1, 0, m->nraw-1); abssens = dvector(0, m->nraw-1); *************** *** 3421,3428 **** double *polys; /* the coeficients */ double scale; /* Absolute scale value */ ! if (m->subtmode) return I1PRO_INT_MALLOC; if (gainmode) { gain = m->highgain; --- 3438,3448 ---- double *polys; /* the coeficients */ double scale; /* Absolute scale value */ ! if (m->subtmode) { ! DBG((dbgo,"i1pro_abssens_to_meas subtmode set\n")) ! if (p->verb) printf("i1pro_abssens_to_meas subtmode set\n"); return I1PRO_INT_MALLOC; + } if (gainmode) { gain = m->highgain; diff --strip-trailing-cr -c -r Argyll_V1.0.0/ucmm/ucmm.c Argyll_V1.0.1/ucmm/ucmm.c *** Argyll_V1.0.0/ucmm/ucmm.c Mon Jun 30 23:21:27 2008 --- Argyll_V1.0.1/ucmm/ucmm.c Wed Jul 9 23:47:58 2008 *************** *** 990,995 **** --- 990,1032 ---- } + /* Return an ASCII error message string interpretation of an error number */ + char *ucmm_error_string(ucmm_error erno) { + + switch (erno) { + case ucmm_ok: + return "OK"; + case ucmm_resource: + return "Resource failure (e.g. out of memory)"; + case ucmm_invalid_profile: + return "Profile is not a valid display ICC profile"; + case ucmm_no_profile: + return "There is no associated profile"; + case ucmm_no_home: + return "There is no HOME environment variable defined"; + case ucmm_no_edid_or_display: + return "There is no edid or display name"; + case ucmm_profile_copy: + return "There was an error copying the profile"; + case ucmm_open_config: + return "There was an error opening the config file"; + case ucmm_access_config: + return "There was an error accessing the config information"; + case ucmm_set_config: + return "There was an error setting the config file"; + case ucmm_save_config: + return "There was an error saving the config file"; + case ucmm_monitor_not_found: + return "The EDID or display wasn't matched"; + case ucmm_delete_key: + return "Delete_key failed"; + case ucmm_delete_profile: + return "Delete_key failed"; + } + return "Unknown error number"; + } + + /* ============================================================= */ /* *************** *** 1105,1107 **** --- 1142,1145 ---- fnv_32_buf(void *buf, size_t len) { return fnv_32_buf_cont(buf, len, FNV1_32_INIT); } + diff --strip-trailing-cr -c -r Argyll_V1.0.0/ucmm/ucmm.h Argyll_V1.0.1/ucmm/ucmm.h *** Argyll_V1.0.0/ucmm/ucmm.h Mon Jun 30 23:21:27 2008 --- Argyll_V1.0.1/ucmm/ucmm.h Wed Jul 9 23:47:58 2008 *************** *** 92,95 **** --- 92,98 ---- char **profile /* Return path to profile. free() afterwards. */ ); + /* Return an ASCII error message string interpretation of an error number */ + char *ucmm_error_string(ucmm_error erno); + #endif /* UCMM_H */ diff --strip-trailing-cr -c -r Argyll_V1.0.0/xicc/Jamfile Argyll_V1.0.1/xicc/Jamfile *** Argyll_V1.0.0/xicc/Jamfile Mon Jun 30 23:21:17 2008 --- Argyll_V1.0.1/xicc/Jamfile Wed Jul 9 23:47:47 2008 *************** *** 16,25 **** #InstallFile ../h : $(Headers) ; #InstallLib ../lib : $(Libraries) ; - # Stop objects that are in more than one library from being - # prematurely deleted: - ObjectKeep xcolorants xutils cam97s3 cam02 ; - HDRS = ../h ../icc ../rspl ../cgats ../numlib ../gamut ../spectro ../profile ../plot $(TIFFINC) $(LibWinH) ; --- 16,21 ---- *************** *** 28,37 **** xcam.c cam97s3.c cam02.c mpp.c xfit.c moncurve.c ; # colorant library. Use instead of libxicc ! LibraryFromObjects libxcolorants : xcolorants ; # standalone utilities library. Use instead of libxicc ! LibraryFromObjects libxutils : xutils ; # Utilities / test programs --- 24,35 ---- xcam.c cam97s3.c cam02.c mpp.c xfit.c moncurve.c ; # colorant library. Use instead of libxicc ! Object xcolorants2 : xcolorants.c ; ! LibraryFromObjects libxcolorants : xcolorants2 ; # standalone utilities library. Use instead of libxicc ! Object xutils2 : xutils.c ; ! LibraryFromObjects libxutils : xutils2 ; # Utilities / test programs *************** *** 62,71 **** # Embedded ICC profile extractor Main extracticc : extracticc.c : : : $(TIFFINC) : : $(TIFFLIB) ; - # Experimental - #Objects osatest.c ; - #MainFromObjects osatest : osatest cam02 ; - # xcolorant lookup test Main xcolorantslu : xcolorantslu.c ; --- 60,65 ---- diff --strip-trailing-cr -c -r Argyll_V1.0.0/xicc/cam02.c Argyll_V1.0.1/xicc/cam02.c *** Argyll_V1.0.0/xicc/cam02.c Mon Jun 30 23:21:18 2008 --- Argyll_V1.0.1/xicc/cam02.c Wed Jul 9 23:47:48 2008 *************** *** 259,265 **** s->F = t_F[i] * (1.0 - bf) + t_F[i+1] * bf; } else { /* Compute the internal parameters by category */ ! switch(s->Ev) { case vc_dark: s->C = 0.525; s->Nc = 0.8; --- 259,265 ---- s->F = t_F[i] * (1.0 - bf) + t_F[i+1] * bf; } else { /* Compute the internal parameters by category */ ! switch(Ev) { case vc_dark: s->C = 0.525; s->Nc = 0.8;