aboutsummaryrefslogtreecommitdiff
path: root/src/BaseDisplay.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/BaseDisplay.hh')
-rw-r--r--src/BaseDisplay.hh175
1 files changed, 0 insertions, 175 deletions
diff --git a/src/BaseDisplay.hh b/src/BaseDisplay.hh
deleted file mode 100644
index d989b54..0000000
--- a/src/BaseDisplay.hh
+++ /dev/null
@@ -1,175 +0,0 @@
1// BaseDisplay.hh for Fluxbox Window Manager
2// Copyright (c) 2001 - 2003 Henrik Kinnunen (fluxgen(at)users.sourceforge.net)
3//
4// BaseDisplay.hh for Blackbox - an X11 Window manager
5// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
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:
13//
14// The above copyright notice and this permission notice shall be included in
15// all copies or substantial portions of the Software.
16//
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.
24
25// $Id: BaseDisplay.hh,v 1.36 2003/05/07 23:45:44 fluxgen Exp $
26
27#ifndef BASEDISPLAY_HH
28#define BASEDISPLAY_HH
29
30#include "NotCopyable.hh"
31#include "App.hh"
32#include "EventHandler.hh"
33
34#include <X11/Xlib.h>
35
36#ifdef XINERAMA
37extern "C" {
38#include <X11/extensions/Xinerama.h>
39}
40#endif // XINERAMA
41
42#include <list>
43#include <vector>
44
45class ScreenInfo;
46
47#define PropBlackboxHintsElements (5)
48#define PropBlackboxAttributesElements (8)
49
50
51/// Singleton class to manage display connection
52/// OBSOLETE!
53class BaseDisplay:public FbTk::App, private FbTk::NotCopyable
54{
55public:
56 BaseDisplay(const char *app_name, const char *display_name = 0);
57 virtual ~BaseDisplay();
58 static BaseDisplay *instance();
59
60 /**
61 obsolete by FluxboxWindow
62 @see FluxboxWindow
63 */
64 enum Attrib {
65 ATTRIB_SHADED = 0x01,
66 ATTRIB_MAXHORIZ = 0x02,
67 ATTRIB_MAXVERT = 0x04,
68 ATTRIB_OMNIPRESENT = 0x08,
69 ATTRIB_WORKSPACE = 0x10,
70 ATTRIB_STACK = 0x20,
71 ATTRIB_DECORATION = 0x40
72 };
73
74 typedef struct _blackbox_hints {
75 unsigned long flags, attrib, workspace, stack;
76 int decoration;
77 } BlackboxHints;
78
79 typedef struct _blackbox_attributes {
80 unsigned long flags, attrib, workspace, stack;
81 int premax_x, premax_y;
82 unsigned int premax_w, premax_h;
83 } BlackboxAttributes;
84
85
86 inline ScreenInfo *getScreenInfo(int s) { return screenInfoList[s]; }
87
88 inline bool hasShapeExtensions() const { return shape.extensions; }
89 inline bool doShutdown() const { return m_shutdown; }
90 inline bool isStartup() const { return m_startup; }
91
92
93 static Display *getXDisplay() { return App::instance()->display(); }
94
95 inline const char *getXDisplayName() const { return m_display_name; }
96 inline const char *getApplicationName() const { return m_app_name; }
97
98 inline int getNumberOfScreens() const { return number_of_screens; }
99 inline int getShapeEventBase() const { return shape.event_basep; }
100
101 inline void shutdown() { m_shutdown = true; }
102 inline void run() { m_startup = m_shutdown = false; }
103
104 bool validateWindow(Window);
105
106 void grab();
107 void ungrab();
108 void eventLoop();
109 virtual void handleEvent(XEvent * const ev) { }
110private:
111
112 struct shape {
113 Bool extensions;
114 int event_basep, error_basep;
115 } shape;
116
117 bool m_startup, m_shutdown;
118
119 typedef std::vector<ScreenInfo *> ScreenInfoList;
120 ScreenInfoList screenInfoList;
121
122 const char *m_display_name, *m_app_name;
123 int number_of_screens, m_server_grabs;
124
125 static BaseDisplay *s_singleton;
126};
127
128
129class ScreenInfo {
130public:
131 explicit ScreenInfo(int screen_num);
132 ~ScreenInfo();
133
134 inline BaseDisplay *getBaseDisplay() { return basedisplay; }
135
136 inline Visual *getVisual() const { return visual; }
137 inline Window getRootWindow() const { return root_window; }
138 inline Colormap colormap() const { return m_colormap; }
139
140 inline int getDepth() const { return depth; }
141 inline int getScreenNumber() const { return screen_number; }
142
143 inline unsigned int getWidth() const { return width; }
144 inline unsigned int getHeight() const { return height; }
145
146#ifdef XINERAMA
147 inline bool hasXinerama() const { return m_hasXinerama; }
148 inline int getNumHeads() const { return xineramaNumHeads; }
149 unsigned int getHead(int x, int y) const;
150 unsigned int getCurrHead() const;
151 unsigned int getHeadWidth(unsigned int head) const;
152 unsigned int getHeadHeight(unsigned int head) const;
153 int getHeadX(unsigned int head) const;
154 int getHeadY(unsigned int head) const;
155#endif // XINERAMA
156
157private:
158 BaseDisplay *basedisplay;
159 Visual *visual;
160 Window root_window;
161 Colormap m_colormap;
162
163 int depth, screen_number;
164 unsigned int width, height;
165#ifdef XINERAMA
166 bool m_hasXinerama;
167 int xineramaMajor, xineramaMinor, xineramaNumHeads, xineramaLastHead;
168 XineramaScreenInfo *xineramaInfos;
169#endif // XINERAMA
170
171};
172
173
174
175#endif // BASEDISPLAY_HH