From 0af01c5e0d8ef221799aebbb0c4882dfbfc2381c Mon Sep 17 00:00:00 2001 From: "Elf M. Sternberg" Date: Mon, 18 Apr 2022 16:01:41 -0700 Subject: [PATCH] Added showing the Output name along with the details (if any). --- xcb_read/Understanding_XRandr.md | 12 +++++++++++- xcb_read/src/xrandr.cpp | 11 +++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/xcb_read/Understanding_XRandr.md b/xcb_read/Understanding_XRandr.md index 0d2f0d2..111699e 100644 --- a/xcb_read/Understanding_XRandr.md +++ b/xcb_read/Understanding_XRandr.md @@ -40,5 +40,15 @@ And the following facts: Work](https://www.x.org/wiki/Development/Documentation/HowVideoCardsWork/)... [TK] - An output can have multiple CRTCs... but usually has only one. +Unresolved questions ... - +- If the output encapsulates the _whole_ of screen (and the root window), when + we rotate the output who does coordinate remapping? I believe that's the + responsibility of the window manager. But if that's true, then what are the + implications for image viewers? + +- If the output encapsulates only a subwindow of the whole, what is the + responsibility of the window manager when the new dimensions fit easily within + the screen as a whole? + + diff --git a/xcb_read/src/xrandr.cpp b/xcb_read/src/xrandr.cpp index e28d9de..24f575d 100644 --- a/xcb_read/src/xrandr.cpp +++ b/xcb_read/src/xrandr.cpp @@ -33,9 +33,20 @@ void display_one_output(xcb_connection_t* connection, xcb_randr_get_output_info_ xcb_timestamp_t timestamp) { xcb_randr_get_crtc_info_reply_t* crtc = xcb_randr_get_crtc_info_reply( connection, xcb_randr_get_crtc_info(connection, output->crtc, timestamp), NULL); + + // Note: This is part of the output structure natively; it's just not + // automagically exposed. (Opaque structures suck.) But it's both accessible + // and null-terminated, so it's relatively safe to use this way, and it does + // not require free() at the end. + auto name = xcb_randr_get_output_info_name(output); + if (name) { + std::cout << "DISPLAY: " << name << std::endl; + } + if (!crtc) { return; } + display_one_crtc(crtc); free(crtc); }