[Xcb] RRGetScreenInfo bad extra len 32 != 48

Guillaume Quintin coincoin169g at gmail.com
Thu May 21 16:15:39 PDT 2009


Hi all,

I am new to xcb programming. Here is the piece of code that causes this 
fatal error :

         xcb_randr_get_screen_info_cookie_t cookie2 = 
xcb_randr_get_screen_info(server,root);
         xcb_randr_get_screen_info_reply_t *reply2 = 
xcb_randr_get_screen_info_reply(server,cookie2,0);

         j = xcb_randr_get_screen_info_sizes_length(reply2);

         printf("Number of screens = %d\n",j);

which is part of the bigger code :

#include <xcb/xcb.h>
#include <xcb/randr.h>
#include <stdlib.h>
#include <stdio.h>

/*
  * to be compiled with -lxcb -lxcb-randr
  */

int main()
{
         xcb_screen_t *screen;
         int i;
         xcb_window_t root;
         xcb_connection_t *server  = xcb_connect(0,&i);

         printf("Default screen : %d\n",i);

         int j = 0;

         xcb_screen_iterator_t iter = 
xcb_setup_roots_iterator(xcb_get_setup(server));

         for( ; iter.rem ; xcb_screen_next(&iter),j++ )
         {
                 screen = iter.data;
                 printf("Monitor number %d :\n",j);
                 printf("Width = %d\n",screen->width_in_pixels);
                 printf("Height = %d\n",screen->height_in_pixels);
                 if ( j == i ) { root = screen->root; }
         }
         printf("Root window has ID %d\n",root);

         printf("\nRandR extension :\n");

         xcb_randr_query_version_cookie_t cookie1 = 
xcb_randr_query_version(server,0,0);
         xcb_randr_query_version_reply_t *reply1 = 
xcb_randr_query_version_reply(server,cookie1,0);
         printf("Version 
%d.%d\n",reply1->major_version,reply1->minor_version);
         free(reply1);

         /*
         xcb_randr_get_screen_info_cookie_t cookie2 = 
xcb_randr_get_screen_info(server,root);
         xcb_randr_get_screen_info_reply_t *reply2 = 
xcb_randr_get_screen_info_reply(server,cookie2,0);

         j = xcb_randr_get_screen_info_sizes_length(reply2);

         printf("Number of screens = %d\n",j);
         */

         xcb_disconnect(server);

         return 0;
}


When executing this code the X server stops suddenly with the following 
message :

Fatal server error:
RRGetScreenInfo bad extra len 32 != 48

I am new with xcb and I have found no doc about randr and xcb so can you 
explain me what is wrong with my code and/or where I can find doc about 
xcb-randr.

Thanks

-- 
Kind regards
Guillaume Quintin


More information about the Xcb mailing list