aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-10-25 20:52:42 (GMT)
committerfluxgen <fluxgen>2002-10-25 20:52:42 (GMT)
commit1cb8a2d14a0c635aa30210c301fba515f640eed3 (patch)
tree5b811cb36048c8581c99a1e42b74c4c2e4571246
parent2f0c8b1c271899d2faa6a475c1872a384c8cf4d3 (diff)
downloadfluxbox_paul-1cb8a2d14a0c635aa30210c301fba515f640eed3.zip
fluxbox_paul-1cb8a2d14a0c635aa30210c301fba515f640eed3.tar.bz2
minor changes for screeninfo constructor
-rw-r--r--src/BaseDisplay.cc35
-rw-r--r--src/BaseDisplay.hh4
2 files changed, 18 insertions, 21 deletions
diff --git a/src/BaseDisplay.cc b/src/BaseDisplay.cc
index d945af6..72c6cdb 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.20 2002/08/30 12:57:41 fluxgen Exp $ 25// $Id: BaseDisplay.cc,v 1.21 2002/10/25 20:51:54 fluxgen Exp $
26 26
27 27
28 28
@@ -183,7 +183,7 @@ m_server_grabs(0)
183 XSetErrorHandler((XErrorHandler) handleXErrors); 183 XSetErrorHandler((XErrorHandler) handleXErrors);
184 184
185 for (int i = 0; i < number_of_screens; i++) { 185 for (int i = 0; i < number_of_screens; i++) {
186 ScreenInfo *screeninfo = new ScreenInfo(this, i); 186 ScreenInfo *screeninfo = new ScreenInfo(i);
187 screenInfoList.push_back(screeninfo); 187 screenInfoList.push_back(screeninfo);
188 } 188 }
189} 189}
@@ -261,21 +261,18 @@ void BaseDisplay::ungrab() {
261 m_server_grabs = 0; 261 m_server_grabs = 0;
262} 262}
263 263
264 264ScreenInfo::ScreenInfo(int num) {
265 265 basedisplay = BaseDisplay::instance();
266 266 Display * const disp = basedisplay->getXDisplay();
267
268ScreenInfo::ScreenInfo(BaseDisplay *d, int num) {
269 basedisplay = d;
270 screen_number = num; 267 screen_number = num;
271 268
272 root_window = RootWindow(basedisplay->getXDisplay(), screen_number); 269 root_window = RootWindow(disp, screen_number);
273 depth = DefaultDepth(basedisplay->getXDisplay(), screen_number); 270 depth = DefaultDepth(disp, screen_number);
274 271
275 width = 272 width =
276 WidthOfScreen(ScreenOfDisplay(basedisplay->getXDisplay(), screen_number)); 273 WidthOfScreen(ScreenOfDisplay(disp, screen_number));
277 height = 274 height =
278 HeightOfScreen(ScreenOfDisplay(basedisplay->getXDisplay(), screen_number)); 275 HeightOfScreen(ScreenOfDisplay(disp, screen_number));
279 276
280 // search for a TrueColor Visual... if we can't find one... we will use the 277 // search for a TrueColor Visual... if we can't find one... we will use the
281 // default visual for the screen 278 // default visual for the screen
@@ -287,7 +284,7 @@ ScreenInfo::ScreenInfo(BaseDisplay *d, int num) {
287 284
288 visual = (Visual *) 0; 285 visual = (Visual *) 0;
289 286
290 if ((vinfo_return = XGetVisualInfo(basedisplay->getXDisplay(), 287 if ((vinfo_return = XGetVisualInfo(disp,
291 VisualScreenMask | VisualClassMask, 288 VisualScreenMask | VisualClassMask,
292 &vinfo_template, &vinfo_nitems)) && 289 &vinfo_template, &vinfo_nitems)) &&
293 vinfo_nitems > 0) { 290 vinfo_nitems > 0) {
@@ -303,20 +300,20 @@ ScreenInfo::ScreenInfo(BaseDisplay *d, int num) {
303 } 300 }
304 301
305 if (visual) { 302 if (visual) {
306 m_colormap = XCreateColormap(basedisplay->getXDisplay(), root_window, 303 m_colormap = XCreateColormap(disp, root_window,
307 visual, AllocNone); 304 visual, AllocNone);
308 } else { 305 } else {
309 visual = DefaultVisual(basedisplay->getXDisplay(), screen_number); 306 visual = DefaultVisual(disp, screen_number);
310 m_colormap = DefaultColormap(basedisplay->getXDisplay(), screen_number); 307 m_colormap = DefaultColormap(disp, screen_number);
311 } 308 }
312 309
313#ifdef XINERAMA 310#ifdef XINERAMA
314 // check if we have Xinerama extension enabled 311 // check if we have Xinerama extension enabled
315 if (XineramaIsActive(basedisplay->getXDisplay())) { 312 if (XineramaIsActive(disp)) {
316 m_hasXinerama = true; 313 m_hasXinerama = true;
317 xineramaLastHead = 0; 314 xineramaLastHead = 0;
318 xineramaInfos = 315 xineramaInfos =
319 XineramaQueryScreens(basedisplay->getXDisplay(), &xineramaNumHeads); 316 XineramaQueryScreens(disp, &xineramaNumHeads);
320 } else { 317 } else {
321 m_hasXinerama = false; 318 m_hasXinerama = false;
322 xineramaInfos = 0; // make sure we don't point anywhere we shouldn't 319 xineramaInfos = 0; // make sure we don't point anywhere we shouldn't
@@ -324,7 +321,7 @@ ScreenInfo::ScreenInfo(BaseDisplay *d, int num) {
324#endif // XINERAMA 321#endif // XINERAMA
325} 322}
326 323
327ScreenInfo::~ScreenInfo(void) { 324ScreenInfo::~ScreenInfo() {
328#ifdef XINERAMA 325#ifdef XINERAMA
329 if (m_hasXinerama) { // only free if we first had it 326 if (m_hasXinerama) { // only free if we first had it
330 XFree(xineramaInfos); 327 XFree(xineramaInfos);
diff --git a/src/BaseDisplay.hh b/src/BaseDisplay.hh
index 142f5dd..0cd2803 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.29 2002/09/08 19:12:33 fluxgen Exp $ 25// $Id: BaseDisplay.hh,v 1.30 2002/10/25 20:52:42 fluxgen Exp $
26 26
27#ifndef BASEDISPLAY_HH 27#ifndef BASEDISPLAY_HH
28#define BASEDISPLAY_HH 28#define BASEDISPLAY_HH
@@ -131,7 +131,7 @@ private:
131 131
132class ScreenInfo { 132class ScreenInfo {
133public: 133public:
134 ScreenInfo(BaseDisplay *bdisp, int screen_num); 134 explicit ScreenInfo(int screen_num);
135 ~ScreenInfo(); 135 ~ScreenInfo();
136 136
137 inline BaseDisplay *getBaseDisplay() { return basedisplay; } 137 inline BaseDisplay *getBaseDisplay() { return basedisplay; }