Пример #1
0
int main(void)
{
	GP_Backend *win_1, *win_2;

	win_1 = GP_BackendX11Init(NULL, 0, 0, 300, 300, "win 1", 0);
	win_2 = GP_BackendX11Init(NULL, 0, 0, 300, 300, "win 2", 0);

	if (win_1 == NULL || win_2 == NULL) {
		GP_BackendExit(win_1);
		GP_BackendExit(win_2);
		return 1;
	}

	/* Update the backend screen */
	redraw(win_1->context);
	redraw(win_2->context);

	GP_BackendFlip(win_1);
	GP_BackendFlip(win_2);

	for (;;) {
		/*
		 * Wait for backend event.
		 *
		 * Either window is fine as they share connection.
		 */
		GP_Backend *b = win_1 ? win_1 : win_2;

		if (b == NULL)
			return 0;

		GP_BackendWait(b);

		if (ev_loop(win_1, "win 1"))
			win_1 = NULL;

		if (ev_loop(win_2, "win 2"))
			win_2 = NULL;
	}

	GP_BackendExit(win_1);
	GP_BackendExit(win_2);

	return 0;
}
Пример #2
0
static GP_Backend *x11_init(char *params, const char *caption)
{
    GP_Size w = 640, h = 480;
    enum GP_BackendX11Flags flags = 0;

    if (parse_x11_params(params, &w, &h, &flags))
        return NULL;

    return GP_BackendX11Init(NULL, 0, 0, w, h, caption, flags);
}