aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gamma-x-randr.c38
-rw-r--r--src/libgamma-method.h4
2 files changed, 40 insertions, 2 deletions
diff --git a/src/gamma-x-randr.c b/src/gamma-x-randr.c
index cc30307..161443b 100644
--- a/src/gamma-x-randr.c
+++ b/src/gamma-x-randr.c
@@ -424,6 +424,41 @@ static int read_output_data(libgamma_crtc_information_t* restrict out, xcb_randr
/**
+ * Determine the connector type from the connector name
+ *
+ * @param this The CRTC information to use and extend
+ * @param Non-zero on error
+ */
+static int get_connector_type(libgamma_crtc_information_t* restrict this)
+{
+ if ((this->connector_type_error = this->connector_name_error))
+ return -1;
+
+#define __select(name, type) \
+ if (strstr(this->connector_name, name "-") == this->connector_name) \
+ return this->connector_type = LIBGAMMA_CONNECTOR_TYPE_##type, 0
+
+ __select ("None", Unknown);
+ __select ("VGA", VGA);
+ __select ("DVI-I", DVII);
+ __select ("DVI-D", DVID);
+ __select ("DVI-A", DVIA);
+ __select ("Composite", Composite);
+ __select ("S-Video", SVIDEO);
+ __select ("Component", Component);
+ __select ("LFP", LFP);
+ __select ("Proprietary", Unknown);
+ __select ("HDMI", HDMI);
+ __select ("DisplayPort", DisplayPort);
+
+#undef __select
+
+ this->connector_name_error = LIBGAMMA_CONNECTOR_TYPE_NOT_RECOGNISED;
+ return -1;
+}
+
+
+/**
* Read information about a CRTC
*
* @param this Instance of a data structure to fill with the information about the CRTC
@@ -455,8 +490,9 @@ int libgamma_x_randr_get_crtc_information(libgamma_crtc_information_t* restrict
/* FIXME output */
- e |= this->connector_type = -1; /* FIXME */
e |= this->connector_name_error = -1; /* FIXME */
+ if ((fields & CRTC_INFO_CONNECTOR_TYPE))
+ e |= get_connector_type(this);
e |= read_output_data(this, output);
if ((fields & (CRTC_INFO_WIDTH_MM | CRTC_INFO_HEIGHT_MM)))
e |= this->width_mm_error | this->height_mm_error;
diff --git a/src/libgamma-method.h b/src/libgamma-method.h
index c1b58b2..0b60b4b 100644
--- a/src/libgamma-method.h
+++ b/src/libgamma-method.h
@@ -335,12 +335,14 @@ typedef enum libgamma_connector_type
LIBGAMMA_CONNECTOR_TYPE_Component,
LIBGAMMA_CONNECTOR_TYPE_9PinDIN,
LIBGAMMA_CONNECTOR_TYPE_DisplayPort,
+ LIBGAMMA_CONNECTOR_TYPE_HDMI,
LIBGAMMA_CONNECTOR_TYPE_HDMIA,
LIBGAMMA_CONNECTOR_TYPE_HDMIB,
LIBGAMMA_CONNECTOR_TYPE_TV,
LIBGAMMA_CONNECTOR_TYPE_eDP,
LIBGAMMA_CONNECTOR_TYPE_VIRTUAL,
- LIBGAMMA_CONNECTOR_TYPE_DSI
+ LIBGAMMA_CONNECTOR_TYPE_DSI,
+ LIBGAMMA_CONNECTOR_TYPE_LFP
} libgamma_connector_type_t;
/**