diff options
author | Mark Tiefenbruck <mark@fluxbox.org> | 2008-01-18 08:33:47 (GMT) |
---|---|---|
committer | Mark Tiefenbruck <mark@fluxbox.org> | 2008-01-18 08:33:47 (GMT) |
commit | 1d4bea8a2db2c0ab1e14b8afd81c87b80a262d66 (patch) | |
tree | 21cc4e919cabe52ab8d355a7ceec980da6fb420a /src/FbTk/FbPixmap.cc | |
parent | 3a5fd7342d6cfd00acafeec4c1f35948a550e4ab (diff) | |
parent | 8c2cee577a744870fd497f73a21c2d4e1c45c907 (diff) | |
download | fluxbox_paul-1d4bea8a2db2c0ab1e14b8afd81c87b80a262d66.zip fluxbox_paul-1d4bea8a2db2c0ab1e14b8afd81c87b80a262d66.tar.bz2 |
Merge branch 'master' of fluxbox@gitfbox:fluxbox
Diffstat (limited to 'src/FbTk/FbPixmap.cc')
-rw-r--r-- | src/FbTk/FbPixmap.cc | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/src/FbTk/FbPixmap.cc b/src/FbTk/FbPixmap.cc index bfd3ead..7c1d674 100644 --- a/src/FbTk/FbPixmap.cc +++ b/src/FbTk/FbPixmap.cc | |||
@@ -24,6 +24,7 @@ | |||
24 | #include "GContext.hh" | 24 | #include "GContext.hh" |
25 | #include "Transparent.hh" | 25 | #include "Transparent.hh" |
26 | #include "FbWindow.hh" | 26 | #include "FbWindow.hh" |
27 | #include "TextUtils.hh" | ||
27 | 28 | ||
28 | #include <X11/Xutil.h> | 29 | #include <X11/Xutil.h> |
29 | #include <X11/Xatom.h> | 30 | #include <X11/Xatom.h> |
@@ -38,21 +39,34 @@ using std::cerr; | |||
38 | 39 | ||
39 | namespace FbTk { | 40 | namespace FbTk { |
40 | 41 | ||
41 | Pixmap *FbPixmap::m_root_pixmaps = 0; | 42 | namespace { |
42 | 43 | ||
43 | const char* FbPixmap::root_prop_ids[] = { | 44 | Pixmap *root_pixmaps = 0; |
45 | |||
46 | const char* root_prop_ids[] = { | ||
44 | "_XROOTPMAP_ID", | 47 | "_XROOTPMAP_ID", |
45 | "_XSETROOT_ID", | 48 | "_XSETROOT_ID", |
46 | 0 | 49 | 0 |
47 | }; | 50 | }; |
48 | 51 | ||
49 | // same number as in root_prop_ids | 52 | // same number as in root_prop_ids |
50 | Atom FbPixmap::root_prop_atoms[] = { | 53 | Atom root_prop_atoms[] = { |
51 | None, | 54 | None, |
52 | None, | 55 | None, |
53 | None | 56 | None |
54 | }; | 57 | }; |
55 | 58 | ||
59 | void checkAtoms() { | ||
60 | |||
61 | Display* display = FbTk::App::instance()->display(); | ||
62 | for (int i=0; root_prop_ids[i] != 0; ++i) { | ||
63 | if (root_prop_atoms[i] == None) { | ||
64 | root_prop_atoms[i] = XInternAtom(display, root_prop_ids[i], False); | ||
65 | } | ||
66 | } | ||
67 | } | ||
68 | |||
69 | }; // end of anonymous namespace | ||
56 | 70 | ||
57 | FbPixmap::FbPixmap():m_pm(0), | 71 | FbPixmap::FbPixmap():m_pm(0), |
58 | m_width(0), m_height(0), | 72 | m_width(0), m_height(0), |
@@ -389,14 +403,14 @@ bool FbPixmap::rootwinPropertyNotify(int screen_num, Atom atom) { | |||
389 | 403 | ||
390 | // returns whether or not the background was changed | 404 | // returns whether or not the background was changed |
391 | bool FbPixmap::setRootPixmap(int screen_num, Pixmap pm) { | 405 | bool FbPixmap::setRootPixmap(int screen_num, Pixmap pm) { |
392 | if (!m_root_pixmaps) { | 406 | if (!root_pixmaps) { |
393 | m_root_pixmaps = new Pixmap[ScreenCount(display())]; | 407 | root_pixmaps = new Pixmap[ScreenCount(display())]; |
394 | for (int i=0; i < ScreenCount(display()); ++i) | 408 | for (int i=0; i < ScreenCount(display()); ++i) |
395 | m_root_pixmaps[i] = None; | 409 | root_pixmaps[i] = None; |
396 | } | 410 | } |
397 | 411 | ||
398 | if (m_root_pixmaps[screen_num] != pm) { | 412 | if (root_pixmaps[screen_num] != pm) { |
399 | m_root_pixmaps[screen_num] = pm; | 413 | root_pixmaps[screen_num] = pm; |
400 | FbWindow::updatedAlphaBackground(screen_num); | 414 | FbWindow::updatedAlphaBackground(screen_num); |
401 | return true; | 415 | return true; |
402 | } | 416 | } |
@@ -410,8 +424,8 @@ Pixmap FbPixmap::getRootPixmap(int screen_num, bool force_update) { | |||
410 | */ | 424 | */ |
411 | 425 | ||
412 | // check and see if if we have the pixmaps in cache | 426 | // check and see if if we have the pixmaps in cache |
413 | if (m_root_pixmaps && !force_update) | 427 | if (root_pixmaps && !force_update) |
414 | return m_root_pixmaps[screen_num]; | 428 | return root_pixmaps[screen_num]; |
415 | 429 | ||
416 | // else setup pixmap cache | 430 | // else setup pixmap cache |
417 | int numscreens = ScreenCount(display()); | 431 | int numscreens = ScreenCount(display()); |
@@ -460,15 +474,7 @@ Pixmap FbPixmap::getRootPixmap(int screen_num, bool force_update) { | |||
460 | setRootPixmap(i, root_pm); | 474 | setRootPixmap(i, root_pm); |
461 | } | 475 | } |
462 | 476 | ||
463 | return m_root_pixmaps[screen_num]; | 477 | 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 | } | 478 | } |
473 | 479 | ||
474 | void FbPixmap::free() { | 480 | void FbPixmap::free() { |