Added the rotation parameter to the display. C++ makes lookup tables

really effing annoying.
This commit is contained in:
Elf M. Sternberg 2022-02-25 07:47:38 -08:00
parent 66b3458bc9
commit 03f0fc82b3
1 changed files with 17 additions and 1 deletions

View File

@ -21,9 +21,25 @@ std::vector<xcb_randr_crtc_t> get_crtc_cookies(xcb_randr_get_screen_resources_re
return reply;
}
const char* rotation_map(uint16_t rotation) {
switch (rotation) {
case XCB_RANDR_ROTATION_ROTATE_0:
return "normal";
case XCB_RANDR_ROTATION_ROTATE_90:
return "portrait";
case XCB_RANDR_ROTATION_ROTATE_180:
return "inverted";
case XCB_RANDR_ROTATION_ROTATE_270:
return "portrait inverted";
default:
return "unknown";
}
}
void display_one_crtc(xcb_randr_get_crtc_info_reply_t* crtc) {
std::cout << "(x: " << crtc->x << ", y: " << crtc->y << ") (width: " << crtc->width
<< ", height: " << crtc->height << ") status:" << unsigned(crtc->status) << std::endl;
<< ", height: " << crtc->height << ") status:" << unsigned(crtc->status)
<< " rotation: " << rotation_map(crtc->rotation) << std::endl;
}
void display_crtc_info(xcb_connection_t* connection, std::vector<xcb_randr_crtc_t>& crtc_cs) {