aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/FbPixmap.cc
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2011-10-23 09:51:36 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2011-10-23 09:51:36 (GMT)
commit2628a0a4cfae6d45f8d3115fecb6ede3f8da02e6 (patch)
treedf918d808ae3dd0f0471286931a9e784379c1d18 /src/FbTk/FbPixmap.cc
parent3fa30a4c823249526ce1d71f2cbf1a1be1a93c4b (diff)
downloadfluxbox_paul-2628a0a4cfae6d45f8d3115fecb6ede3f8da02e6.zip
fluxbox_paul-2628a0a4cfae6d45f8d3115fecb6ede3f8da02e6.tar.bz2
clean up resources on shutdown
Diffstat (limited to 'src/FbTk/FbPixmap.cc')
-rw-r--r--src/FbTk/FbPixmap.cc22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/FbTk/FbPixmap.cc b/src/FbTk/FbPixmap.cc
index 160d478..90a1754 100644
--- a/src/FbTk/FbPixmap.cc
+++ b/src/FbTk/FbPixmap.cc
@@ -29,6 +29,7 @@
29#include <X11/Xutil.h> 29#include <X11/Xutil.h>
30#include <X11/Xatom.h> 30#include <X11/Xatom.h>
31#include <iostream> 31#include <iostream>
32#include <vector>
32#ifdef HAVE_CSTRING 33#ifdef HAVE_CSTRING
33 #include <cstring> 34 #include <cstring>
34#else 35#else
@@ -41,7 +42,7 @@ namespace FbTk {
41 42
42namespace { 43namespace {
43 44
44Pixmap *root_pixmaps = 0; 45std::vector <Pixmap> s_root_pixmaps;
45 46
46struct RootProps { 47struct RootProps {
47 const char* name; 48 const char* name;
@@ -409,14 +410,15 @@ bool FbPixmap::rootwinPropertyNotify(int screen_num, Atom atom) {
409 410
410// returns whether or not the background was changed 411// returns whether or not the background was changed
411bool FbPixmap::setRootPixmap(int screen_num, Pixmap pm) { 412bool FbPixmap::setRootPixmap(int screen_num, Pixmap pm) {
412 if (!root_pixmaps) { 413
413 root_pixmaps = new Pixmap[ScreenCount(display())]; 414 if (s_root_pixmaps.empty()) {
414 for (int i=0; i < ScreenCount(display()); ++i) 415 int i;
415 root_pixmaps[i] = None; 416 for (i = 0; i < ScreenCount(display()); ++i)
417 s_root_pixmaps.push_back(None);
416 } 418 }
417 419
418 if (root_pixmaps[screen_num] != pm) { 420 if (s_root_pixmaps[screen_num] != pm) {
419 root_pixmaps[screen_num] = pm; 421 s_root_pixmaps[screen_num] = pm;
420 FbWindow::updatedAlphaBackground(screen_num); 422 FbWindow::updatedAlphaBackground(screen_num);
421 return true; 423 return true;
422 } 424 }
@@ -430,8 +432,8 @@ Pixmap FbPixmap::getRootPixmap(int screen_num, bool force_update) {
430 */ 432 */
431 433
432 // check and see if if we have the pixmaps in cache 434 // check and see if if we have the pixmaps in cache
433 if (root_pixmaps && !force_update) 435 if (!s_root_pixmaps.empty() && !force_update)
434 return root_pixmaps[screen_num]; 436 return s_root_pixmaps[screen_num];
435 437
436 checkAtoms(); 438 checkAtoms();
437 439
@@ -481,7 +483,7 @@ Pixmap FbPixmap::getRootPixmap(int screen_num, bool force_update) {
481 setRootPixmap(i, root_pm); 483 setRootPixmap(i, root_pm);
482 } 484 }
483 485
484 return root_pixmaps[screen_num]; 486 return s_root_pixmaps[screen_num];
485} 487}
486 488
487void FbPixmap::free() { 489void FbPixmap::free() {