aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-06-03 05:44:53 +0200
committerMattias Andrée <maandree@operamail.com>2014-06-03 05:44:53 +0200
commit44c164bb350500c8231b59c1723eca0686a89b22 (patch)
tree26c6ef946f3d32971157f4ddd021557ad45cd70e /src
parentgamma-linux-drm: fix partition init bug (diff)
downloadlibgamma-44c164bb350500c8231b59c1723eca0686a89b22.tar.gz
libgamma-44c164bb350500c8231b59c1723eca0686a89b22.tar.bz2
libgamma-44c164bb350500c8231b59c1723eca0686a89b22.tar.xz
fix errors in gamma-x-randr
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src')
-rw-r--r--src/lib/gamma-x-randr.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/gamma-x-randr.c b/src/lib/gamma-x-randr.c
index af3fe50..7ca8674 100644
--- a/src/lib/gamma-x-randr.c
+++ b/src/lib/gamma-x-randr.c
@@ -192,7 +192,7 @@ int libgamma_x_randr_site_initialise(libgamma_site_state_t* restrict this,
/* Connect to the display server. */
this->data = connection = xcb_connect(site, NULL);
if (connection == NULL)
- return LIBGAMMA_NO_SUCH_SITE;
+ return LIBGAMMA_OPEN_SITE_FAILED;
/* Query the version of the X RandR extension protocol. */
cookie = xcb_randr_query_version(connection, RANDR_VERSION_MAJOR, RANDR_VERSION_MINOR);
@@ -203,6 +203,10 @@ int libgamma_x_randr_site_initialise(libgamma_site_state_t* restrict this,
{
/* Release resources. */
free(reply);
+ /* If `xcb_connect` failed, both `error` and `reply` will be `NULL`.
+ XXX: Can both be `NULL` for any other reason? */
+ if ((error == NULL) && (reply == NULL))
+ return LIBGAMMA_OPEN_SITE_FAILED;
xcb_disconnect(connection);
/* Translate and report error. */
if (error != NULL)
@@ -311,6 +315,7 @@ int libgamma_x_randr_partition_initialise(libgamma_partition_state_t* restrict t
/* Get screen list. */
if ((setup = xcb_get_setup(connection)) == NULL)
return LIBGAMMA_LIST_PARTITIONS_FAILED;
+ iter = xcb_setup_roots_iterator(setup);
/* Get the screen. */
for (i = 0; iter.rem > 0; i++, xcb_screen_next(&iter))