[PATCH] Mac OS X support

Bug #1225567 reported by Geoffrey Thomas
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Redshift
New
Undecided
Unassigned

Bug Description

Hi,

Redshift is awesome and I use it all the time on my personal Debian laptop. I also use a Mac sometimes for work and I wanted it running there.

I've written a patch to add a gamma backend for the Quartz Display Services API, which is attached and also available at
https://ldpreload.com/p/redshift-macosx.patch

The patch is against the 1.7 release tarball (I don't have bzr on my Mac). Apart from autotools, it doesn't require anything that's not on a standard Mac system.

The API is documented at
https://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/Quartz_Services_Ref/Reference/reference.html
(see the "Adjusting the Display Gamma" section)

A couple of notes:
- The API seems to reset color configuration when the process exits. This is pretty reasonable, honestly, but it does mean that one-shot mode doesn't work.
- I added a fallback dummy definition of PKG_CHECK_MODULES to configure.ac so that I don't need pkg-config and its aclocal module installed.
- The API takes floats, not uint16_ts. Apparently every other backend wants uint16_t.
- The 0-to-1 ramp does not seem to be the default gamma ramp -- my first attempt made the screen significantly brighter and I think slightly bluer. So I assume that the current gamma ramp corresponds to 6500 K, and multiply the retrieved gamma ramp (instead of a 0-to-1 ramp) by the coefficients provided to me. This seems to be the only way to avoid a discontinuity with the fade-in. I refactored a bit of code in colorramp.c to accomplish this.
- I haven't yet added configuration for multiple monitors or similar.
- I haven't added a menubar icon a la gtk-redshift.

Let me know what you think. I'll add multiple monitor configuration and rebase against bzr sometime soon.

Revision history for this message
Geoffrey Thomas (geofft) wrote :
Revision history for this message
Jon Lund Steffensen (jonls) wrote :

Thanks, I just saw this patch today. Apparently I get no notification from launchpad anymore when bugs are posted. Do you think it would be possible to apply the redshift correction on top of the existing gamma ramps? That might fix the fourth issue you mentioned. Also, I have started moving development to http://github.com/jonls/redshift so if you don't mind using git instead of bzr you might want to use that repository.

Revision history for this message
Geoffrey Thomas (geofft) wrote :

Git is more familiar for me, so I went ahead and rebased my patch just now and uploaded it to GitHub. Should we move to a pull request thread there?

Regarding the color correction bit, I think that's what I'm currently doing -- I fetch the current gamma ramp, and then multiply the redshift "brightness * white_point" correction by that. But it does mean that any gamma provided to redshift is ignored. I'm curious whether you think this is the best way or there's a better option here.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.