Esempio n. 1
0
/*
 * Setup_Display_And_Screen: This routine opens up the correct display (i.e.,
 *                           it calls Get_Display_Name) and then stores a
 *                           pointer to it in dpy.  The default screen
 *                           for this display is then stored in screen.
 *                           Does not require dpy or screen defined.
 */
void Setup_Display_And_Screen(
    int *argc,      /* MODIFIED */
    char **argv)    /* MODIFIED */
{
        char *displayname = NULL;

        displayname = Get_Display_Name(argc, argv);
	dpy = Open_Display (displayname);
	screen = XDefaultScreen(dpy);
}
Esempio n. 2
0
/*
 * Setup_Display_And_Screen: This routine opens up the correct display (i.e.,
 *                           it calls Get_Display_Name) and then stores a
 *                           pointer to it in dpy.  The default screen
 *                           for this display is then stored in screen.
 */
void Setup_Display_And_Screen (
    const char *display_name,
    xcb_connection_t **dpy,	/* MODIFIED */
    xcb_screen_t **screen)	/* MODIFIED */
{
    int screen_number, i;

    /* Open Display */
    *dpy = xcb_connect (display_name, &screen_number);
    if (xcb_connection_has_error (*dpy)) {
	Fatal_Error ("unable to open display \"%s\"",
		     Get_Display_Name(display_name) );
    }

    if (screen) {
	/* find our screen */
	const xcb_setup_t *setup = xcb_get_setup(*dpy);
	xcb_screen_iterator_t screen_iter = xcb_setup_roots_iterator(setup);

	for (i = 0; i < screen_number; i++)
	    xcb_screen_next(&screen_iter);
	*screen = screen_iter.data;
    }
}