summaryrefslogtreecommitdiff
path: root/src/x.hpp
blob: d01e00e150a2b53a90cf9a485ba163cb0827c24e (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* x.hpp: Handles starting and managing X
 *
 * Copyright (C) 2014: Dalton Nell, Maim Contributors (https://github.com/naelstrof/maim/graphs/contributors).
 *
 * This file is part of Maim.
 *
 * Maim is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Maim is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Maim.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef MAIM_X_H_
#define MAIM_X_H_

#include <X11/Xlib.h>
#include <X11/extensions/Xrandr.h>
#include <cstdlib>
#include <vector>
#include <string>
#include <cstdio>

namespace maim {

class XEngine {
public:
                        XEngine();
                        ~XEngine();
    int                 init( std::string display );
    Display*            m_display;
    Visual*             m_visual;
    Screen*             m_screen;
    Colormap            m_colormap;
    Window              m_root;
    XRRScreenResources* m_res;
    bool                m_good;
    Window              getWindowByID( int id );
    std::vector<XRRCrtcInfo*>        getCRTCS();
    void                freeCRTCS( std::vector<XRRCrtcInfo*> monitors );
};

int IgnoreErrorHandler( Display* dpy, XErrorEvent* event );

}

extern maim::XEngine* xengine;

#endif // MAIM_X_H_