diff options
-rw-r--r-- | src/FbTk/Transparent.cc | 28 | ||||
-rw-r--r-- | src/FbTk/Transparent.hh | 15 |
2 files changed, 23 insertions, 20 deletions
diff --git a/src/FbTk/Transparent.cc b/src/FbTk/Transparent.cc index 7db207a..b5bcca9 100644 --- a/src/FbTk/Transparent.cc +++ b/src/FbTk/Transparent.cc | |||
@@ -25,15 +25,13 @@ | |||
25 | 25 | ||
26 | #ifdef HAVE_XRENDER | 26 | #ifdef HAVE_XRENDER |
27 | #include <X11/extensions/Xrender.h> | 27 | #include <X11/extensions/Xrender.h> |
28 | #endif // HAVE_XRENDER | ||
29 | 28 | ||
30 | #include <iostream> | 29 | #include <iostream> |
31 | #include <stdio.h> | 30 | #include <cstdio> |
32 | |||
33 | 31 | ||
34 | #ifdef HAVE_XRENDER | ||
35 | using std::cerr; | 32 | using std::cerr; |
36 | using std::endl; | 33 | using std::endl; |
34 | |||
37 | #endif // HAVE_XRENDER | 35 | #endif // HAVE_XRENDER |
38 | 36 | ||
39 | 37 | ||
@@ -99,16 +97,14 @@ Picture createAlphaPic(Window drawable, int alpha) { | |||
99 | return alpha_pic; | 97 | return alpha_pic; |
100 | } | 98 | } |
101 | #endif // HAVE_XRENDER | 99 | #endif // HAVE_XRENDER |
102 | } | ||
103 | 100 | ||
104 | namespace FbTk { | 101 | bool s_init = false; |
102 | bool s_render = false; | ||
103 | bool s_composite = false; | ||
104 | bool s_use_composite = false; | ||
105 | 105 | ||
106 | bool Transparent::s_init = false; | 106 | void init() { |
107 | bool Transparent::s_render = false; | ||
108 | bool Transparent::s_composite = false; | ||
109 | bool Transparent::s_use_composite = false; | ||
110 | 107 | ||
111 | void Transparent::init() { | ||
112 | Display *disp = FbTk::App::instance()->display(); | 108 | Display *disp = FbTk::App::instance()->display(); |
113 | 109 | ||
114 | int major_opcode, first_event, first_error; | 110 | int major_opcode, first_event, first_error; |
@@ -129,6 +125,16 @@ void Transparent::init() { | |||
129 | s_init = true; | 125 | s_init = true; |
130 | } | 126 | } |
131 | 127 | ||
128 | } | ||
129 | |||
130 | namespace FbTk { | ||
131 | |||
132 | bool Transparent::haveRender() { | ||
133 | if (!s_init) | ||
134 | init(); | ||
135 | return s_render; | ||
136 | } | ||
137 | |||
132 | void Transparent::usePseudoTransparent(bool force) { | 138 | void Transparent::usePseudoTransparent(bool force) { |
133 | if (!s_init) | 139 | if (!s_init) |
134 | init(); | 140 | init(); |
diff --git a/src/FbTk/Transparent.hh b/src/FbTk/Transparent.hh index 8e9d9b9..a0c689e 100644 --- a/src/FbTk/Transparent.hh +++ b/src/FbTk/Transparent.hh | |||
@@ -29,6 +29,12 @@ namespace FbTk { | |||
29 | /// renders to drawable together with an alpha mask | 29 | /// renders to drawable together with an alpha mask |
30 | class Transparent { | 30 | class Transparent { |
31 | public: | 31 | public: |
32 | |||
33 | static bool haveComposite(bool for_real = false); | ||
34 | static bool haveRender(); | ||
35 | static void usePseudoTransparent(bool force); | ||
36 | |||
37 | |||
32 | Transparent(Drawable source, Drawable dest, int alpha, int screen_num); | 38 | Transparent(Drawable source, Drawable dest, int alpha, int screen_num); |
33 | ~Transparent(); | 39 | ~Transparent(); |
34 | /// sets alpha value | 40 | /// sets alpha value |
@@ -49,9 +55,6 @@ public: | |||
49 | Drawable dest() const { return m_dest; } | 55 | Drawable dest() const { return m_dest; } |
50 | Drawable source() const { return m_source; } | 56 | Drawable source() const { return m_source; } |
51 | 57 | ||
52 | static bool haveComposite(bool for_real = false); | ||
53 | static bool haveRender() { if (!s_init) init(); return s_render; } | ||
54 | static void usePseudoTransparent(bool force); | ||
55 | 58 | ||
56 | private: | 59 | private: |
57 | void freeAlpha(); | 60 | void freeAlpha(); |
@@ -61,12 +64,6 @@ private: | |||
61 | unsigned long m_dest_pic; | 64 | unsigned long m_dest_pic; |
62 | Drawable m_source, m_dest; | 65 | Drawable m_source, m_dest; |
63 | unsigned char m_alpha; | 66 | unsigned char m_alpha; |
64 | |||
65 | static bool s_init; | ||
66 | static bool s_render; ///< wheter we have RENDER support | ||
67 | static bool s_composite; ///< wheter we have Composite support | ||
68 | static bool s_use_composite; ///< whether or not to use Composite | ||
69 | static void init(); | ||
70 | }; | 67 | }; |
71 | 68 | ||
72 | } // end namespace FbTk | 69 | } // end namespace FbTk |