/* cc -Wall -g XRandR.c -o XRandR -lX11 `pkg-config --libs xrandr` */ #include #include #include int main(void) { Display *display; int screen; Window root; int x, y, i, j; unsigned int width, height, border_width, depth; if( (display = XOpenDisplay(":0.0")) == 0 ) { fprintf( stderr, "Could not open X display\n" ); return 1; } screen = DefaultScreen( display ); XGetGeometry( display, RootWindow( display, screen ), &root, &x, &y, &width, &height, &border_width, &depth ); fprintf( stdout, "root = %d x = %d y = %d width = %d height = %d " "border_width = %d depth = %d\n", (int)root, x, y, width, height, border_width, depth ); XRRScreenResources * res = XRRGetScreenResources(display, root); for(i = 0; i < res->noutput; ++i) { XRROutputInfo * output = XRRGetOutputInfo( display, res, res->outputs[i] ); for ( j = 0; j < output->ncrtc; ++j) { XRRCrtcGamma * gamma = XRRGetCrtcGamma( display, output->crtcs[j] ); fprintf( stdout, "output %d: crtc %d: gamma size: %d\n", i, j, gamma->size); XRRFreeGamma( gamma ); } XRRFreeOutputInfo( output ); } XRRFreeScreenResources(res); res = 0; return 0; }