diff options
author | Mathias Gumz <akira at fluxbox dot org> | 2008-01-14 22:27:00 (GMT) |
---|---|---|
committer | Mathias Gumz <akira at fluxbox dot org> | 2008-01-14 22:27:00 (GMT) |
commit | e1db89e2d7d56afca5335550ee1c9ff87fd54ba4 (patch) | |
tree | 779b52814dedd08eb56d1875cb2f97bbcdd39e8b /src/FbTk/FbPixmap.cc | |
parent | c6099d777d844699fb8a4243921159898bc4f45c (diff) | |
download | fluxbox_pavel-e1db89e2d7d56afca5335550ee1c9ff87fd54ba4.zip fluxbox_pavel-e1db89e2d7d56afca5335550ee1c9ff87fd54ba4.tar.bz2 |
moved code a bit around, cleaned up some classes
Diffstat (limited to 'src/FbTk/FbPixmap.cc')
-rw-r--r-- | src/FbTk/FbPixmap.cc | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/src/FbTk/FbPixmap.cc b/src/FbTk/FbPixmap.cc index bfd3ead..9d90c5a 100644 --- a/src/FbTk/FbPixmap.cc +++ b/src/FbTk/FbPixmap.cc | |||
@@ -38,21 +38,34 @@ using std::cerr; | |||
38 | 38 | ||
39 | namespace FbTk { | 39 | namespace FbTk { |
40 | 40 | ||
41 | Pixmap *FbPixmap::m_root_pixmaps = 0; | 41 | namespace { |
42 | 42 | ||
43 | const char* FbPixmap::root_prop_ids[] = { | 43 | Pixmap *root_pixmaps = 0; |
44 | |||
45 | const char* root_prop_ids[] = { | ||
44 | "_XROOTPMAP_ID", | 46 | "_XROOTPMAP_ID", |
45 | "_XSETROOT_ID", | 47 | "_XSETROOT_ID", |
46 | 0 | 48 | 0 |
47 | }; | 49 | }; |
48 | 50 | ||
49 | // same number as in root_prop_ids | 51 | // same number as in root_prop_ids |
50 | Atom FbPixmap::root_prop_atoms[] = { | 52 | Atom root_prop_atoms[] = { |
51 | None, | 53 | None, |
52 | None, | 54 | None, |
53 | None | 55 | None |
54 | }; | 56 | }; |
55 | 57 | ||
58 | void checkAtoms() { | ||
59 | |||
60 | Display* display = FbTk::App::instance()->display(); | ||
61 | for (int i=0; root_prop_ids[i] != 0; ++i) { | ||
62 | if (root_prop_atoms[i] == None) { | ||
63 | root_prop_atoms[i] = XInternAtom(display, root_prop_ids[i], False); | ||
64 | } | ||
65 | } | ||
66 | } | ||
67 | |||
68 | }; // end of anonymous namespace | ||
56 | 69 | ||
57 | FbPixmap::FbPixmap():m_pm(0), | 70 | FbPixmap::FbPixmap():m_pm(0), |
58 | m_width(0), m_height(0), | 71 | m_width(0), m_height(0), |
@@ -389,14 +402,14 @@ bool FbPixmap::rootwinPropertyNotify(int screen_num, Atom atom) { | |||
389 | 402 | ||
390 | // returns whether or not the background was changed | 403 | // returns whether or not the background was changed |
391 | bool FbPixmap::setRootPixmap(int screen_num, Pixmap pm) { | 404 | bool FbPixmap::setRootPixmap(int screen_num, Pixmap pm) { |
392 | if (!m_root_pixmaps) { | 405 | if (!root_pixmaps) { |
393 | m_root_pixmaps = new Pixmap[ScreenCount(display())]; | 406 | root_pixmaps = new Pixmap[ScreenCount(display())]; |
394 | for (int i=0; i < ScreenCount(display()); ++i) | 407 | for (int i=0; i < ScreenCount(display()); ++i) |
395 | m_root_pixmaps[i] = None; | 408 | root_pixmaps[i] = None; |
396 | } | 409 | } |
397 | 410 | ||
398 | if (m_root_pixmaps[screen_num] != pm) { | 411 | if (root_pixmaps[screen_num] != pm) { |
399 | m_root_pixmaps[screen_num] = pm; | 412 | root_pixmaps[screen_num] = pm; |
400 | FbWindow::updatedAlphaBackground(screen_num); | 413 | FbWindow::updatedAlphaBackground(screen_num); |
401 | return true; | 414 | return true; |
402 | } | 415 | } |
@@ -410,8 +423,8 @@ Pixmap FbPixmap::getRootPixmap(int screen_num, bool force_update) { | |||
410 | */ | 423 | */ |
411 | 424 | ||
412 | // check and see if if we have the pixmaps in cache | 425 | // check and see if if we have the pixmaps in cache |
413 | if (m_root_pixmaps && !force_update) | 426 | if (root_pixmaps && !force_update) |
414 | return m_root_pixmaps[screen_num]; | 427 | return root_pixmaps[screen_num]; |
415 | 428 | ||
416 | // else setup pixmap cache | 429 | // else setup pixmap cache |
417 | int numscreens = ScreenCount(display()); | 430 | int numscreens = ScreenCount(display()); |
@@ -460,15 +473,7 @@ Pixmap FbPixmap::getRootPixmap(int screen_num, bool force_update) { | |||
460 | setRootPixmap(i, root_pm); | 473 | setRootPixmap(i, root_pm); |
461 | } | 474 | } |
462 | 475 | ||
463 | return m_root_pixmaps[screen_num]; | 476 | return root_pixmaps[screen_num]; |
464 | } | ||
465 | |||
466 | void FbPixmap::checkAtoms() { | ||
467 | for (int i=0; root_prop_ids[i] != 0; ++i) { | ||
468 | if (root_prop_atoms[i] == None) { | ||
469 | root_prop_atoms[i] = XInternAtom(display(), root_prop_ids[i], False); | ||
470 | } | ||
471 | } | ||
472 | } | 477 | } |
473 | 478 | ||
474 | void FbPixmap::free() { | 479 | void FbPixmap::free() { |