aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-06-03 07:33:31 +0200
committerMattias Andrée <maandree@operamail.com>2014-06-03 07:33:31 +0200
commit9362c381072627b08ca42d6d9f909f9597902dfa (patch)
tree0ce35b3bdef1d078a6d3714b7a3ce6a69d54105b /src/lib
parentinfo: m (diff)
downloadlibgamma-9362c381072627b08ca42d6d9f909f9597902dfa.tar.gz
libgamma-9362c381072627b08ca42d6d9f909f9597902dfa.tar.bz2
libgamma-9362c381072627b08ca42d6d9f909f9597902dfa.tar.xz
m fixes + print all crtc info , except connector type and subpixel order, in the test
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/fake-quartz-cg.c4
-rw-r--r--src/lib/fake-w32-gdi.c4
-rw-r--r--src/lib/gamma-x-randr.c19
-rw-r--r--src/lib/libgamma-facade.c.gpp10
-rw-r--r--src/lib/libgamma-method.h9
5 files changed, 39 insertions, 7 deletions
diff --git a/src/lib/fake-quartz-cg.c b/src/lib/fake-quartz-cg.c
index 1fcfaf3..3ce7449 100644
--- a/src/lib/fake-quartz-cg.c
+++ b/src/lib/fake-quartz-cg.c
@@ -147,8 +147,10 @@ static uint16_t* restrict original_ramps = NULL;
/* xcb violates the rule to never return struct:s. */
+#ifdef __GNUC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Waggregate-return"
+#endif
CGError CGGetOnlineDisplayList(uint32_t max_size,
@@ -362,7 +364,9 @@ uint32_t CGDisplayGammaTableCapacity(CGDirectDisplayID display)
}
+#ifdef __GNUC__
# pragma GCC diagnostic pop
+#endif
void close_fake_quartz_cg(void)
diff --git a/src/lib/fake-w32-gdi.c b/src/lib/fake-w32-gdi.c
index c5bf8a3..c4d7c11 100644
--- a/src/lib/fake-w32-gdi.c
+++ b/src/lib/fake-w32-gdi.c
@@ -205,8 +205,10 @@ int GetDeviceCaps(HDC hDC, int nIndex)
/* xcb violates the rule to never return struct:s. */
+#ifdef __GNUC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Waggregate-return"
+#endif
/* http://msdn.microsoft.com/en-us/library/windows/desktop/dd372194(v=vs.85).aspx */
@@ -318,7 +320,9 @@ HDC CreateDC(LPCTSTR restrict lpszDriver, LPCTSTR restrict lpszDevice,
}
+#ifdef __GNUC__
# pragma GCC diagnostic pop
+#endif
/* http://msdn.microsoft.com/en-us/library/windows/desktop/dd162609(v=vs.85).aspx */
diff --git a/src/lib/gamma-x-randr.c b/src/lib/gamma-x-randr.c
index 7ca8674..86e5450 100644
--- a/src/lib/gamma-x-randr.c
+++ b/src/lib/gamma-x-randr.c
@@ -162,8 +162,10 @@ void libgamma_x_randr_method_capabilities(libgamma_method_capabilities_t* restri
/* xcb violates the rule to never return struct:s. */
+#ifdef __GNUC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Waggregate-return"
+#endif
/**
@@ -604,6 +606,7 @@ static int get_connector_type(libgamma_crtc_information_t* restrict this)
__select ("DVI-I", DVII);
__select ("DVI-D", DVID);
__select ("DVI-A", DVIA);
+ __select ("DVI", DVI);
__select ("Composite", Composite);
__select ("S-Video", SVIDEO);
__select ("Component", Component);
@@ -641,7 +644,7 @@ static int get_output_name(libgamma_crtc_information_t* restrict out, xcb_randr_
return out->connector_name_error = LIBGAMMA_REPLY_VALUE_EXTRACTION_FAILED;
/* Allocate a memory area for a NUL-terminated copy of the name. */
- store = malloc(((size_t)length + 1) * sizeof(char));
+ store = out->connector_name = malloc(((size_t)length + 1) * sizeof(char));
if (store == NULL)
return out->connector_name_error = errno, -1;
@@ -750,6 +753,7 @@ static int get_edid(libgamma_crtc_information_t* restrict out,
}
/* Store the EDID. */
+ out->edid_length = (size_t)length;
out->edid = malloc((size_t)length * sizeof(unsigned char));
if (out->edid == NULL)
out->edid_error = errno;
@@ -783,7 +787,7 @@ int libgamma_x_randr_get_crtc_information(libgamma_crtc_information_t* restrict
int e = 0;
xcb_randr_get_output_info_reply_t* restrict output_info = NULL;
xcb_randr_output_t output;
- int free_edid;
+ int free_edid, free_name;
/* Wipe all error indicators. */
memset(this, 0, sizeof(libgamma_crtc_information_t));
@@ -791,6 +795,9 @@ int libgamma_x_randr_get_crtc_information(libgamma_crtc_information_t* restrict
/* We need to free the EDID after us if it is not explicitly requested. */
free_edid = (fields & LIBGAMMA_CRTC_INFO_EDID) == 0;
+ /* We need to free the output's name after us if it is not explicitly requested. */
+ free_name = (fields & LIBGAMMA_CRTC_INFO_CONNECTOR_NAME) == 0;
+
/* Jump if the output information is not required. */
if ((fields & (LIBGAMMA_CRTC_INFO_MACRO_ACTIVE | LIBGAMMA_CRTC_INFO_MACRO_CONNECTOR)) == 0)
goto cont;
@@ -875,6 +882,12 @@ int libgamma_x_randr_get_crtc_information(libgamma_crtc_information_t* restrict
free(this->edid);
this->edid = NULL;
}
+ /* Free the output name after us. */
+ if (free_name)
+ {
+ free(this->connector_name);
+ this->connector_name = NULL;
+ }
free(output_info);
return e ? -1 : 0;
@@ -961,5 +974,7 @@ int libgamma_x_randr_crtc_set_gamma_ramps(libgamma_crtc_state_t* restrict this,
}
+#ifdef __GNUC__
# pragma GCC diagnostic pop
+#endif
diff --git a/src/lib/libgamma-facade.c.gpp b/src/lib/libgamma-facade.c.gpp
index 038fad4..d380d97 100644
--- a/src/lib/libgamma-facade.c.gpp
+++ b/src/lib/libgamma-facade.c.gpp
@@ -60,8 +60,10 @@ lowercase ()
not have any adjustment methods enabled. */
#ifndef HAVE_LIBGAMMA_METHODS
# define HAVE_NO_LIBGAMMA_METHODS
-# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored "-Wsuggest-attribute=const"
+# ifdef __GNUC__
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wsuggest-attribute=const"
+# endif
#endif
@@ -1050,6 +1052,8 @@ int libgamma_crtc_set_gamma_£{2}_f(libgamma_crtc_state_t* restrict this,
#ifdef HAVE_NO_LIBGAMMA_METHODS
-# pragma GCC diagnostic pop
+# ifdef __GNUC__
+# pragma GCC diagnostic pop
+# endif
#endif
diff --git a/src/lib/libgamma-method.h b/src/lib/libgamma-method.h
index 143f17c..d57d3cb 100644
--- a/src/lib/libgamma-method.h
+++ b/src/lib/libgamma-method.h
@@ -320,6 +320,11 @@ typedef enum libgamma_connector_type
LIBGAMMA_CONNECTOR_TYPE_VGA,
/**
+ * Digital Visual Interface, unknown type.
+ */
+ LIBGAMMA_CONNECTOR_TYPE_DVI,
+
+ /**
* Digital Visual Interface, integrated (DVI-I).
*/
LIBGAMMA_CONNECTOR_TYPE_DVII,
@@ -410,7 +415,7 @@ typedef enum libgamma_connector_type
/**
* The number of values defined in `libgamma_connector_type_t`.
*/
-#define LIBGAMMA_CONNECTOR_TYPE_COUNT 19
+#define LIBGAMMA_CONNECTOR_TYPE_COUNT 20
/**
* Orders for subpixels. Currently the possible values are
@@ -533,7 +538,7 @@ typedef enum libgamma_subpixel_order
/**
* For a `libgamma_crtc_information_t` fill in the
* values for `gamma_red`, `gamma_green` and `gamma_blue`
- * and report errors to `connector_type_error`.
+ * and report errors to `gamma_error`.
*/
#define LIBGAMMA_CRTC_INFO_GAMMA (1 << 12)