Source

Mirror / include / window.h

#ifndef WINDOW_H
#define WINDOW_H
#include <iostream>
#include <string>
#include <utility>

#include <xcb/xcb.h>
#include <xcb/xcb_icccm.h>
#include <xcb/xcb_ewmh.h>

#include "setup.h"

typedef std::pair<std::string, std::string> StringPair;
 
class Window
{
    public:
        Window(Setup *setup, xcb_window_t id);
        Window();
        ~Window();
        xcb_window_t id;
        bool exempt;
        bool fullscreen;
        std::string tagName;
        std::string name;
        StringPair wmClass;
        bool transient;
        bool inputHint;
        bool takeFocus;
        void handleHints();
        void handleGeometry();
        void handleTransient();
        void handleName();
        void handleClass();
        void focus();
        void close();
        void stackAbove();
        void stackBelow();
        void map();
        void unmap();
        xcb_rectangle_t getGeometry();
        void setGeometry(xcb_rectangle_t rect);
        explicit operator bool() const
        {
            return id != XCB_NONE;
        };

    private:
        Setup *setup;
        xcb_rectangle_t geometry;
        void sendTakeFocus();
        void sendConfigureNotify();

};

#endif //WINDOW_H