Move internal code to internal side of FbTk::Transparent

This commit is contained in:
Mathias Gumz 2015-02-08 11:06:58 +01:00
parent 495846f1ee
commit 9f824b89fd
2 changed files with 23 additions and 20 deletions

View file

@ -25,15 +25,13 @@
#ifdef HAVE_XRENDER
#include <X11/extensions/Xrender.h>
#endif // HAVE_XRENDER
#include <iostream>
#include <stdio.h>
#include <cstdio>
#ifdef HAVE_XRENDER
using std::cerr;
using std::endl;
#endif // HAVE_XRENDER
@ -99,16 +97,14 @@ Picture createAlphaPic(Window drawable, int alpha) {
return alpha_pic;
}
#endif // HAVE_XRENDER
}
namespace FbTk {
bool s_init = false;
bool s_render = false;
bool s_composite = false;
bool s_use_composite = false;
bool Transparent::s_init = false;
bool Transparent::s_render = false;
bool Transparent::s_composite = false;
bool Transparent::s_use_composite = false;
void init() {
void Transparent::init() {
Display *disp = FbTk::App::instance()->display();
int major_opcode, first_event, first_error;
@ -129,6 +125,16 @@ void Transparent::init() {
s_init = true;
}
}
namespace FbTk {
bool Transparent::haveRender() {
if (!s_init)
init();
return s_render;
}
void Transparent::usePseudoTransparent(bool force) {
if (!s_init)
init();

View file

@ -29,6 +29,12 @@ namespace FbTk {
/// renders to drawable together with an alpha mask
class Transparent {
public:
static bool haveComposite(bool for_real = false);
static bool haveRender();
static void usePseudoTransparent(bool force);
Transparent(Drawable source, Drawable dest, int alpha, int screen_num);
~Transparent();
/// sets alpha value
@ -49,9 +55,6 @@ public:
Drawable dest() const { return m_dest; }
Drawable source() const { return m_source; }
static bool haveComposite(bool for_real = false);
static bool haveRender() { if (!s_init) init(); return s_render; }
static void usePseudoTransparent(bool force);
private:
void freeAlpha();
@ -61,12 +64,6 @@ private:
unsigned long m_dest_pic;
Drawable m_source, m_dest;
unsigned char m_alpha;
static bool s_init;
static bool s_render; ///< wheter we have RENDER support
static bool s_composite; ///< wheter we have Composite support
static bool s_use_composite; ///< whether or not to use Composite
static void init();
};
} // end namespace FbTk