don't include "cvs" in the version (not using cvs anymore :D)
[blackbox.git] / lib / Display.hh
blobe32e478127473d9602a391be94b7840ea007a17c
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 // Display.hh for Blackbox - an X11 Window manager
3 // Copyright (c) 2001 - 2005 Sean 'Shaleh' Perry <shaleh at debian.org>
4 // Copyright (c) 1997 - 2000, 2002 - 2005
5 // Bradley T Hughes <bhughes at trolltech.com>
6 //
7 // Permission is hereby granted, free of charge, to any person obtaining a
8 // copy of this software and associated documentation files (the "Software"),
9 // to deal in the Software without restriction, including without limitation
10 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 // and/or sell copies of the Software, and to permit persons to whom the
12 // Software is furnished to do so, subject to the following conditions:
14 // The above copyright notice and this permission notice shall be included in
15 // all copies or substantial portions of the Software.
17 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 // DEALINGS IN THE SOFTWARE.
25 #ifndef __Display_hh
26 #define __Display_hh
28 #include "Rect.hh"
29 #include "Util.hh"
31 #include <X11/Xlib.h>
33 namespace bt {
35 // forward declarations
36 class ScreenInfo;
38 class Display : public NoCopy {
39 private:
40 ::Display *xdisplay;
41 ScreenInfo** screen_info_list;
42 size_t screen_info_count;
44 public:
45 Display(const char *dpy_name, bool multi_head);
46 ~Display(void);
48 inline ::Display* XDisplay(void) const
49 { return xdisplay; }
51 inline unsigned int screenCount(void) const
52 { return screen_info_count; }
53 const ScreenInfo &screenInfo(unsigned int i) const;
56 class ScreenInfo: public NoCopy {
57 private:
58 Display& _display;
59 Visual *_visual;
60 Window _rootwindow;
61 Colormap _colormap;
62 int _depth;
63 unsigned int _screennumber;
64 std::string _displaystring;
65 Rect _rect;
67 public:
68 ScreenInfo(Display& d, unsigned int num);
70 inline Display& display(void) const
71 { return _display; }
73 inline Visual *visual(void) const
74 { return _visual; }
75 inline Window rootWindow(void) const
76 { return _rootwindow; }
77 inline Colormap colormap(void) const
78 { return _colormap; }
80 inline int depth(void) const
81 { return _depth; }
83 inline unsigned int screenNumber(void) const
84 { return _screennumber; }
86 inline const Rect& rect(void) const
87 { return _rect; }
88 inline unsigned int width(void) const
89 { return _rect.width(); }
90 inline unsigned int height(void) const
91 { return _rect.height(); }
93 inline const std::string& displayString(void) const
94 { return _displaystring; }
97 } // namespace bt
99 #endif // __Display_hh