aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/gamma-dummy.c.gpp4
-rw-r--r--src/lib/gamma-linux-drm.c4
-rw-r--r--src/lib/gamma-quartz-cg.c2
-rw-r--r--src/lib/gamma-w32-gdi.c2
-rw-r--r--src/lib/gamma-x-randr.c4
-rw-r--r--src/lib/gamma-x-vidmode.c2
-rw-r--r--src/lib/libgamma-method.h40
7 files changed, 52 insertions, 6 deletions
diff --git a/src/lib/gamma-dummy.c.gpp b/src/lib/gamma-dummy.c.gpp
index 1ceb4a6..24e9d41 100644
--- a/src/lib/gamma-dummy.c.gpp
+++ b/src/lib/gamma-dummy.c.gpp
@@ -295,9 +295,11 @@ static libgamma_dummy_configurations_t libgamma_dummy_configurations =
*/
void libgamma_dummy_method_capabilities(libgamma_method_capabilities_t* restrict this)
{
+ int real_method = libgamma_dummy_configurations.real_method;
*this = libgamma_dummy_configurations.capabilities;
- this->real = libgamma_dummy_configurations.real_method != LIBGAMMA_METHOD_DUMMY;
+ this->real = real_method != LIBGAMMA_METHOD_DUMMY;
this->fake = this->real;
+ this->auto_restore = real_method == LIBGAMMA_METHOD_QUARTZ_CORE_GRAPHICS;
}
diff --git a/src/lib/gamma-linux-drm.c b/src/lib/gamma-linux-drm.c
index 38c23ed..b785c9f 100644
--- a/src/lib/gamma-linux-drm.c
+++ b/src/lib/gamma-linux-drm.c
@@ -114,6 +114,8 @@ void libgamma_linux_drm_method_capabilities(libgamma_method_capabilities_t* rest
/* DRM is a real non-faked adjustment method */
this->real = 1;
this->fake = 0;
+ /* Gamma ramp adjustments are persistent. */
+ this->auto_restore = 0;
}
@@ -827,7 +829,7 @@ int libgamma_linux_drm_get_crtc_information(libgamma_crtc_information_t* restric
e |= (fields & LIBGAMMA_CRTC_INFO_GAMMA_SIZE) ? get_gamma_ramp_size(this, crtc) : 0;
/* Store gamma ramp depth. */
this->gamma_depth = 16;
- /* X RandR does not support quering gamma ramp support. */
+ /* DRM does not support quering gamma ramp support. */
e |= this->gamma_support_error = _E(LIBGAMMA_CRTC_INFO_GAMMA_SUPPORT);
/* Free the EDID after us. */
diff --git a/src/lib/gamma-quartz-cg.c b/src/lib/gamma-quartz-cg.c
index 8f11729..585d868 100644
--- a/src/lib/gamma-quartz-cg.c
+++ b/src/lib/gamma-quartz-cg.c
@@ -77,6 +77,8 @@ void libgamma_quartz_cg_method_capabilities(libgamma_method_capabilities_t* rest
this->fake = 0;
this->real = 1;
#endif
+ /* Gamma ramp adjustments are non-persistent. */
+ this->auto_restore = 1;
}
diff --git a/src/lib/gamma-w32-gdi.c b/src/lib/gamma-w32-gdi.c
index 3dd367d..1dcf169 100644
--- a/src/lib/gamma-w32-gdi.c
+++ b/src/lib/gamma-w32-gdi.c
@@ -84,6 +84,8 @@ void libgamma_w32_gdi_method_capabilities(libgamma_method_capabilities_t* restri
this->fake = 0;
this->real = 1;
#endif
+ /* Gamma ramp adjustments are persistent. */
+ this->auto_restore = 0;
}
diff --git a/src/lib/gamma-x-randr.c b/src/lib/gamma-x-randr.c
index 2fefed4..af818f3 100644
--- a/src/lib/gamma-x-randr.c
+++ b/src/lib/gamma-x-randr.c
@@ -155,9 +155,11 @@ void libgamma_x_randr_method_capabilities(libgamma_method_capabilities_t* restri
this->fixed_gamma_size = 0;
/* Gamma ramp depths are fixed. */
this->fixed_gamma_depth = 1;
- /* X RandR is a real non-faked adjustment method */
+ /* X RandR is a real non-faked adjustment method. */
this->real = 1;
this->fake = 0;
+ /* Gamma ramp adjustments are persistent. */
+ this->auto_restore = 0;
}
diff --git a/src/lib/gamma-x-vidmode.c b/src/lib/gamma-x-vidmode.c
index 71f318b..9651894 100644
--- a/src/lib/gamma-x-vidmode.c
+++ b/src/lib/gamma-x-vidmode.c
@@ -60,6 +60,8 @@ void libgamma_x_vidmode_method_capabilities(libgamma_method_capabilities_t* rest
/* X VidMode is a real non-faked adjustment method */
this->real = 1;
this->fake = 0;
+ /* Gamma ramp adjustments are persistent. */
+ this->auto_restore = 0;
}
diff --git a/src/lib/libgamma-method.h b/src/lib/libgamma-method.h
index 58598a4..76a8f40 100644
--- a/src/lib/libgamma-method.h
+++ b/src/lib/libgamma-method.h
@@ -163,7 +163,7 @@ typedef struct libgamma_method_capabilities
* Whether the adjustment method supports `libgamma_crtc_restore`.
*/
unsigned crtc_restore : 1;
-
+
/**
* Whether the `red_gamma_size`, `green_gamma_size` and `blue_gamma_size`
* fields in `libgamma_crtc_information_t` will always have the same
@@ -194,6 +194,12 @@ typedef struct libgamma_method_capabilities
*/
unsigned fake : 1;
+ /**
+ * Whether adjustments are undone when the process disconnects from
+ * the display server.
+ */
+ unsigned auto_restore : 1;
+
} libgamma_method_capabilities_t;
@@ -474,6 +480,29 @@ typedef enum libgamma_subpixel_order
/**
+ * Answer enum to a decision problem.
+ */
+typedef enum libgamma_decision
+ {
+ /**
+ * The answer is negative.
+ */
+ LIBGAMMA_NO = 0,
+
+ /**
+ * The answer is unknown.
+ */
+ LIBGAMMA_MAYBE = 1,
+
+ /**
+ * The answer is positive.
+ */
+ LIBGAMMA_YES = 2
+
+ } libgamma_decision_t;
+
+
+/**
* For a `libgamma_crtc_information_t` fill in the
* values for `edid` and `edid_length` and report errors to `edid_error`.
*/
@@ -756,9 +785,14 @@ typedef struct libgamma_crtc_information
/**
- * Non-zero gamma ramp adjustments are supported.
+ * `LIBGAMMA_NO` indicates that the CRTC does not support
+ * gamma ramp adjustments. `LIBGAMMA_MAYBE` indicates that
+ * the CRTC may or may not support gamma ramp adjustments,
+ * meaning that the display server really does not know, but
+ * the protocol is available. `LIBGAMMA_NO` indicates that
+ * the CRTC does support gamma ramp adjustments.
*/
- int gamma_support;
+ libgamma_decision_t gamma_support;
/**
* Zero on success, positive it holds the value `errno` had