Added showing the Output name along with the details (if any).

This commit is contained in:
Elf M. Sternberg 2022-04-18 16:01:41 -07:00
parent f60e935ffe
commit 0af01c5e0d
2 changed files with 22 additions and 1 deletions

View File

@ -40,5 +40,15 @@ And the following facts:
Work](https://www.x.org/wiki/Development/Documentation/HowVideoCardsWork/)... [TK] Work](https://www.x.org/wiki/Development/Documentation/HowVideoCardsWork/)... [TK]
- An output can have multiple CRTCs... but usually has only one. - 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?

View File

@ -33,9 +33,20 @@ void display_one_output(xcb_connection_t* connection, xcb_randr_get_output_info_
xcb_timestamp_t timestamp) { xcb_timestamp_t timestamp) {
xcb_randr_get_crtc_info_reply_t* crtc = xcb_randr_get_crtc_info_reply( 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); 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) { if (!crtc) {
return; return;
} }
display_one_crtc(crtc); display_one_crtc(crtc);
free(crtc); free(crtc);
} }