summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-02-23 22:05:56 +0100
committerMattias Andrée <maandree@operamail.com>2014-02-23 22:05:56 +0100
commit6e640eea3b3a081fb47b2798c10ccc2b85ccddc2 (patch)
treec120e8b6de6a1d71884e16efbc9daa8a0ed24a0b /src
parentbasic screen, output and crtc listing with physical size and connection status (diff)
downloadblueshift-6e640eea3b3a081fb47b2798c10ccc2b85ccddc2.tar.gz
blueshift-6e640eea3b3a081fb47b2798c10ccc2b85ccddc2.tar.bz2
blueshift-6e640eea3b3a081fb47b2798c10ccc2b85ccddc2.tar.xz
output names
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src')
-rw-r--r--src/blueshift_crtc_c.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/blueshift_crtc_c.c b/src/blueshift_crtc_c.c
index a874f5e..83c33c6 100644
--- a/src/blueshift_crtc_c.c
+++ b/src/blueshift_crtc_c.c
@@ -16,7 +16,7 @@
*/
#include <stdlib.h>
#include <stdio.h>
-#include <inttypes.h>
+#include <string.h>
#include <xcb/xcb.h>
#include <xcb/randr.h>
@@ -125,6 +125,9 @@ int main(int argc __attribute__((unused)), char** argv __attribute__((unused)))
{
xcb_randr_get_output_info_cookie_t out_cookie;
xcb_randr_get_output_info_reply_t* out_reply;
+ char* name;
+ char* name_;
+ int i;
out_cookie = xcb_randr_get_output_info(connection, outputs[output_i], res_reply->config_timestamp);
out_reply = xcb_randr_get_output_info_reply(connection, out_cookie, &error);
@@ -137,21 +140,32 @@ int main(int argc __attribute__((unused)), char** argv __attribute__((unused)))
}
printf(" Output: %i\n", output_i);
+
+ name_ = xcb_randr_get_output_info_name(out_reply);
+ name = alloca((out_reply->name_len + 1) * sizeof(char));
+ memcpy(name, name_, out_reply->name_len * sizeof(char));
+ *(name + out_reply->name_len) = 0;
+ printf(" Name: %s\n", name);
+
switch (out_reply->connection)
{
case XCB_RANDR_CONNECTION_CONNECTED:
{
int crtc_i;
+
printf(" Connection: connected\n");
printf(" Size: %i %i\n", out_reply->mm_width, out_reply->mm_height);
+
for (crtc_i = 0; crtc_i < res_reply->num_crtcs; crtc_i++)
if (crtcs[crtc_i] == out_reply->crtc)
printf(" CRTC: %i\n", crtc_i);
}
break;
+
case XCB_RANDR_CONNECTION_DISCONNECTED:
printf(" Connection: disconnected\n");
break;
+
case XCB_RANDR_CONNECTION_UNKNOWN:
default:
printf(" Connection: unknown\n");