diff --git a/src/xrandr.cpp b/src/xrandr.cpp index 89a978a..5945370 100644 --- a/src/xrandr.cpp +++ b/src/xrandr.cpp @@ -21,9 +21,25 @@ std::vector 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& crtc_cs) {