aboutsummaryrefslogtreecommitdiff
path: root/include/mglpp/mglpp.hpp
blob: 730ddf5036d106f06a5d2e9baea35e3f713eb977 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef MGLPP_MGLPP_HPP
#define MGLPP_MGLPP_HPP

#include <exception>

namespace mgl {
    enum class WindowSystem {
        NATIVE,  // Use X11 on X11 and Wayland on Wayland
        X11,     // Use X11 on X11 and XWayland on Wayland
        WAYLAND, // Use Wayland. If user runs on X11 then it fails to connect
    };

    class InitException : public std::exception {
    public:
        const char* what() const noexcept override {
            return "Failed to initialize mgl";
        }
    };

    class Init {
    public:
        // Throws InitException on failure.
        Init(WindowSystem window_system = WindowSystem::X11);
        ~Init();

        bool is_connected_to_display_server();
        void ping_display_server();
    };
}

#endif /* MGLPP_MGLPP_HPP */