summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-08-30 12:58:08 (GMT)
committerfluxgen <fluxgen>2002-08-30 12:58:08 (GMT)
commit65a124a83cded041ac8025ac4493793db4c76ca0 (patch)
treed9a1838f006485303af46b69fa7164a33d8c1bc5 /src
parent99083a7051bf5c6d4c7b05e1eef234929029cc5e (diff)
downloadfluxbox_lack-65a124a83cded041ac8025ac4493793db4c76ca0.zip
fluxbox_lack-65a124a83cded041ac8025ac4493793db4c76ca0.tar.bz2
static Display
Diffstat (limited to 'src')
-rw-r--r--src/BaseDisplay.cc29
-rw-r--r--src/BaseDisplay.hh6
2 files changed, 18 insertions, 17 deletions
diff --git a/src/BaseDisplay.cc b/src/BaseDisplay.cc
index d38e2e9..d945af6 100644
--- a/src/BaseDisplay.cc
+++ b/src/BaseDisplay.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: BaseDisplay.cc,v 1.19 2002/08/17 22:11:23 fluxgen Exp $ 25// $Id: BaseDisplay.cc,v 1.20 2002/08/30 12:57:41 fluxgen Exp $
26 26
27 27
28 28
@@ -136,6 +136,7 @@ void bexec(const char *command, char *displaystring) {
136 136
137 137
138BaseDisplay *BaseDisplay::s_singleton = 0; 138BaseDisplay *BaseDisplay::s_singleton = 0;
139Display *BaseDisplay::s_display = 0;
139 140
140BaseDisplay::BaseDisplay(const char *app_name, const char *dpy_name): 141BaseDisplay::BaseDisplay(const char *app_name, const char *dpy_name):
141m_startup(true), m_shutdown(false), 142m_startup(true), m_shutdown(false),
@@ -150,7 +151,7 @@ m_server_grabs(0)
150 last_bad_window = None; 151 last_bad_window = None;
151 I18n *i18n = I18n::instance(); 152 I18n *i18n = I18n::instance();
152 153
153 if (! (m_display = XOpenDisplay(dpy_name))) { 154 if (! (s_display = XOpenDisplay(dpy_name))) {
154 fprintf(stderr, 155 fprintf(stderr,
155 i18n-> 156 i18n->
156 getMessage( 157 getMessage(
@@ -158,7 +159,7 @@ m_server_grabs(0)
158 "BaseDisplay::BaseDisplay: connection to X server failed.\n")); 159 "BaseDisplay::BaseDisplay: connection to X server failed.\n"));
159 160
160 throw static_cast<int>(2); //throw error 2 161 throw static_cast<int>(2); //throw error 2
161 } else if (fcntl(ConnectionNumber(m_display), F_SETFD, 1) == -1) { 162 } else if (fcntl(ConnectionNumber(s_display), F_SETFD, 1) == -1) {
162 fprintf(stderr, 163 fprintf(stderr,
163 i18n-> 164 i18n->
164 getMessage( 165 getMessage(
@@ -169,10 +170,10 @@ m_server_grabs(0)
169 } 170 }
170 171
171 172
172 number_of_screens = ScreenCount(m_display); 173 number_of_screens = ScreenCount(s_display);
173 174
174#ifdef SHAPE 175#ifdef SHAPE
175 shape.extensions = XShapeQueryExtension(m_display, &shape.event_basep, 176 shape.extensions = XShapeQueryExtension(s_display, &shape.event_basep,
176 &shape.error_basep); 177 &shape.error_basep);
177#else // !SHAPE 178#else // !SHAPE
178 shape.extensions = False; 179 shape.extensions = False;
@@ -196,8 +197,8 @@ BaseDisplay::~BaseDisplay() {
196 delete (*it); 197 delete (*it);
197 } 198 }
198 199
199 XCloseDisplay(m_display); 200 XCloseDisplay(s_display);
200 201 s_display = 0;
201 s_singleton = 0; 202 s_singleton = 0;
202} 203}
203 204
@@ -212,9 +213,9 @@ void BaseDisplay::eventLoop() {
212 run(); 213 run();
213 214
214 while ((! m_shutdown) && (! internal_error)) { 215 while ((! m_shutdown) && (! internal_error)) {
215 if (XPending(m_display)) { 216 if (XPending(s_display)) {
216 XEvent e; 217 XEvent e;
217 XNextEvent(m_display, &e); 218 XNextEvent(s_display, &e);
218 219
219 if (last_bad_window != None && e.xany.window == last_bad_window) { 220 if (last_bad_window != None && e.xany.window == last_bad_window) {
220#ifdef DEBUG 221#ifdef DEBUG
@@ -230,7 +231,7 @@ void BaseDisplay::eventLoop() {
230 handleEvent(&e); 231 handleEvent(&e);
231 } 232 }
232 } else { 233 } else {
233 BTimer::updateTimers(ConnectionNumber(m_display)); //handle all timers 234 BTimer::updateTimers(ConnectionNumber(s_display)); //handle all timers
234 } 235 }
235 } 236 }
236} 237}
@@ -238,8 +239,8 @@ void BaseDisplay::eventLoop() {
238 239
239bool BaseDisplay::validateWindow(Window window) { 240bool BaseDisplay::validateWindow(Window window) {
240 XEvent event; 241 XEvent event;
241 if (XCheckTypedWindowEvent(m_display, window, DestroyNotify, &event)) { 242 if (XCheckTypedWindowEvent(s_display, window, DestroyNotify, &event)) {
242 XPutBackEvent(m_display, &event); 243 XPutBackEvent(s_display, &event);
243 return false; 244 return false;
244 } 245 }
245 246
@@ -249,13 +250,13 @@ bool BaseDisplay::validateWindow(Window window) {
249 250
250void BaseDisplay::grab() { 251void BaseDisplay::grab() {
251 if (! m_server_grabs++) 252 if (! m_server_grabs++)
252 XGrabServer(m_display); 253 XGrabServer(s_display);
253} 254}
254 255
255 256
256void BaseDisplay::ungrab() { 257void BaseDisplay::ungrab() {
257 if (! --m_server_grabs) 258 if (! --m_server_grabs)
258 XUngrabServer(m_display); 259 XUngrabServer(s_display);
259 if (m_server_grabs < 0) 260 if (m_server_grabs < 0)
260 m_server_grabs = 0; 261 m_server_grabs = 0;
261} 262}
diff --git a/src/BaseDisplay.hh b/src/BaseDisplay.hh
index 1624a05..0a35dd1 100644
--- a/src/BaseDisplay.hh
+++ b/src/BaseDisplay.hh
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: BaseDisplay.hh,v 1.26 2002/08/17 22:10:03 fluxgen Exp $ 25// $Id: BaseDisplay.hh,v 1.27 2002/08/30 12:58:08 fluxgen Exp $
26 26
27#ifndef BASEDISPLAY_HH 27#ifndef BASEDISPLAY_HH
28#define BASEDISPLAY_HH 28#define BASEDISPLAY_HH
@@ -92,7 +92,7 @@ public:
92 inline bool isStartup() const { return m_startup; } 92 inline bool isStartup() const { return m_startup; }
93 93
94 94
95 inline Display *getXDisplay() { return m_display; } 95 static Display *getXDisplay() { return s_display; }
96 96
97 inline const char *getXDisplayName() const { return m_display_name; } 97 inline const char *getXDisplayName() const { return m_display_name; }
98 inline const char *getApplicationName() const { return m_app_name; } 98 inline const char *getApplicationName() const { return m_app_name; }
@@ -128,7 +128,7 @@ private:
128 } shape; 128 } shape;
129 129
130 bool m_startup, m_shutdown; 130 bool m_startup, m_shutdown;
131 Display *m_display; 131 static Display *s_display;
132 132
133 typedef std::vector<ScreenInfo *> ScreenInfoList; 133 typedef std::vector<ScreenInfo *> ScreenInfoList;
134 ScreenInfoList screenInfoList; 134 ScreenInfoList screenInfoList;