From d40779510d77f9bd00d801f1cc8ea4e638032ab6 Mon Sep 17 00:00:00 2001 From: intexisty <30681593+intexisty@users.noreply.github.com> Date: Tue, 7 Dec 2021 20:40:14 -0600 Subject: [PATCH] Create a simple window to ensure XCB is linked properly --- src/main.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index b60aad8..8aecdd6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,9 @@ #include #include +#include +#include + #include "config/config.h" #include "xdg.hpp" @@ -15,7 +18,24 @@ int main() { Config config(path); #endif - std::cout << "Terminal: \"" << config.programs.terminal << "\" - Launcher: \"" << config.programs.launcher << "\"" << std::endl; + // opens connection to display server (xorg) + xcb_connection_t* connection = xcb_connect(NULL, NULL); + + // grab first screen + 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; + + // create basic window + 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); + + std::cout << "Press any key to resume"; + int x = std::cin.get(); + + xcb_disconnect(connection); return 0; } \ No newline at end of file