aboutsummaryrefslogtreecommitdiffstats
path: root/src/gamma-w32-gdi.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-05-22 21:12:44 +0200
committerMattias Andrée <maandree@operamail.com>2014-05-22 21:12:44 +0200
commitab7f957f377cc1d28d35785fefb185533da9f6e4 (patch)
treeca7370b75b0d033b0105987fc4d1ebf23ea7b72d /src/gamma-w32-gdi.c
parentm misc + gamma-quartz-cg (diff)
downloadlibgamma-ab7f957f377cc1d28d35785fefb185533da9f6e4.tar.gz
libgamma-ab7f957f377cc1d28d35785fefb185533da9f6e4.tar.bz2
libgamma-ab7f957f377cc1d28d35785fefb185533da9f6e4.tar.xz
m
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/gamma-w32-gdi.c')
-rw-r--r--src/gamma-w32-gdi.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gamma-w32-gdi.c b/src/gamma-w32-gdi.c
index 5065641..50683a9 100644
--- a/src/gamma-w32-gdi.c
+++ b/src/gamma-w32-gdi.c
@@ -143,6 +143,8 @@ int libgamma_w32_gdi_partition_initialise(libgamma_partition_state_t* restrict t
if (partition != 0)
return LIBGAMMA_NO_SUCH_PARTITION;
+ /* Count CRTC:s by iteration over all possible identifiers
+ until we reach on that does not exist. */
display.cb = sizeof(DISPLAY_DEVICE);
while (EnumDisplayDevices(NULL, n, &display, 0))
if (n++, n == 0)
@@ -196,11 +198,16 @@ int libgamma_w32_gdi_crtc_initialise(libgamma_crtc_state_t* restrict this,
(void) partition;
this->data = NULL;
- display.cb = sizeof(DISPLAY_DEVICE);
+
+ display.cb = sizeof(DISPLAY_DEVICE); /* Windows's API mandates this... */
+ /* Get identifier for selected CRTC. */
if (!EnumDisplayDevices(NULL, (DWORD)crtc, &display, 0))
return LIBGAMMA_NO_SUCH_CRTC;
+ /* Check that the connector is enabled,
+ * newer versions of Windows will always pass. */
if (!(display.StateFlags & DISPLAY_DEVICE_ACTIVE))
return LIBGAMMA_CONNECTOR_DISABLED;
+ /* Acquire CRTC connection. */
context = CreateDC(TEXT("DISPLAY"), display.DeviceName, NULL, NULL);
if (context == NULL)
return LIBGAMMA_OPEN_CRTC_FAILED;