aboutsummaryrefslogtreecommitdiff
path: root/demos/xcb/start/main.cpp
blob: c4e3761ecf70423e1297186704e087f6d68e763a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <unistd.h>
#include <xcb/xcb.h>

int main() {
  int screen_num;
  xcb_connection_t* connection = xcb_connect(NULL, &screen_num);
  const xcb_setup_t* setup = xcb_get_setup(connection);
  xcb_screen_iterator_t iter = xcb_setup_roots_iterator(setup);
  xcb_screen_t* screen = iter.data;

  xcb_window_t window = xcb_generate_id(connection);
  xcb_create_window(connection, XCB_COPY_FROM_PARENT, window, screen->root, 0,
                    0, 150, 150, 10, XCB_WINDOW_CLASS_INPUT_OUTPUT,
                    screen->root_visual, 0, NULL);
  xcb_map_window(connection, window);
  xcb_flush(connection);

  pause();

  xcb_disconnect(connection);

  return 0;
}