aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
authormarkt <markt>2007-01-06 19:03:33 (GMT)
committermarkt <markt>2007-01-06 19:03:33 (GMT)
commit94e2c89053325beeb9f79d2e682adf614f636ca8 (patch)
treeb778a387684ef8baef35e318c75de1810408a7f4 /src/FbTk
parent8db2d4f26eae2d608e864aabf6218ad461c4da6b (diff)
downloadfluxbox_pavel-94e2c89053325beeb9f79d2e682adf614f636ca8.zip
fluxbox_pavel-94e2c89053325beeb9f79d2e682adf614f636ca8.tar.bz2
make "force pseudotransparency" menu item work immediately
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/Menu.cc12
-rw-r--r--src/FbTk/Transparent.cc42
-rw-r--r--src/FbTk/Transparent.hh3
3 files changed, 25 insertions, 32 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
index 9206ade..e7fc6d8 100644
--- a/src/FbTk/Menu.cc
+++ b/src/FbTk/Menu.cc
@@ -1099,14 +1099,18 @@ void Menu::keyPressEvent(XKeyEvent &event) {
1099 1099
1100void Menu::reconfigure() { 1100void Menu::reconfigure() {
1101 1101
1102 if (FbTk::Transparent::haveComposite()) 1102 if (FbTk::Transparent::haveComposite()) {
1103 menu.window.setOpaque(alpha()); 1103 menu.window.setOpaque(alpha());
1104 menu.title.setAlpha(255);
1105 menu.frame.setAlpha(255);
1106 } else {
1107 menu.window.setOpaque(255);
1108 menu.title.setAlpha(alpha());
1109 menu.frame.setAlpha(alpha());
1110 }
1104 1111
1105 m_need_update = true; // redraw items 1112 m_need_update = true; // redraw items
1106 1113
1107 menu.title.setAlpha(alpha());
1108 menu.frame.setAlpha(alpha());
1109
1110 menu.window.setBorderColor(theme().borderColor()); 1114 menu.window.setBorderColor(theme().borderColor());
1111 menu.title.setBorderColor(theme().borderColor()); 1115 menu.title.setBorderColor(theme().borderColor());
1112 menu.frame.setBorderColor(theme().borderColor()); 1116 menu.frame.setBorderColor(theme().borderColor());
diff --git a/src/FbTk/Transparent.cc b/src/FbTk/Transparent.cc
index 6563d5a..d80b2b2 100644
--- a/src/FbTk/Transparent.cc
+++ b/src/FbTk/Transparent.cc
@@ -112,6 +112,7 @@ namespace FbTk {
112bool Transparent::s_init = false; 112bool Transparent::s_init = false;
113bool Transparent::s_render = false; 113bool Transparent::s_render = false;
114bool Transparent::s_composite = false; 114bool Transparent::s_composite = false;
115bool Transparent::s_use_composite = false;
115 116
116void Transparent::init() { 117void Transparent::init() {
117 Display *disp = FbTk::App::instance()->display(); 118 Display *disp = FbTk::App::instance()->display();
@@ -119,48 +120,35 @@ void Transparent::init() {
119 int major_opcode, first_event, first_error; 120 int major_opcode, first_event, first_error;
120 if (XQueryExtension(disp, "RENDER", 121 if (XQueryExtension(disp, "RENDER",
121 &major_opcode, 122 &major_opcode,
122 &first_event, &first_error) == False) { 123 &first_event, &first_error)) {
123 s_render = false; 124 // we have XRENDER support
124 s_composite = false;
125 } else { // we have RENDER support
126 s_render = true; 125 s_render = true;
127 126
128 if (XQueryExtension(disp, "Composite", 127 if (XQueryExtension(disp, "Composite",
129 &major_opcode, 128 &major_opcode,
130 &first_event, &first_error) == False) { 129 &first_event, &first_error)) {
131 s_composite = false; 130 // we have Composite support
132 } else { // we have Composite support
133 s_composite = true; 131 s_composite = true;
132 s_use_composite = true;
134 } 133 }
135 } 134 }
136 s_init = true; 135 s_init = true;
137} 136}
138 137
139void Transparent::usePseudoTransparent(bool no_composite) { 138void Transparent::usePseudoTransparent(bool force) {
140 if (s_composite != no_composite) 139 if (!s_init)
141 return; 140 init();
142 141 s_use_composite = (!force && s_composite);
143 s_init = false;
144 init(); // only use render if we have it
145
146 if (no_composite)
147 s_composite = false;
148} 142}
149 143
150bool Transparent::haveComposite(bool for_real) { 144bool Transparent::haveComposite(bool for_real) {
151 if (for_real) { 145 if (!s_init)
152 Display *disp = FbTk::App::instance()->display(); 146 init();
153 int major_opcode, first_event, first_error;
154
155 return (XQueryExtension(disp, "Composite",
156 &major_opcode,
157 &first_event, &first_error) == True);
158 } else {
159 if (!s_init)
160 init();
161 147
148 if (for_real)
162 return s_composite; 149 return s_composite;
163 } 150 else
151 return s_use_composite;
164} 152}
165 153
166Transparent::Transparent(Drawable src, Drawable dest, unsigned char alpha, int screen_num): 154Transparent::Transparent(Drawable src, Drawable dest, unsigned char alpha, int screen_num):
diff --git a/src/FbTk/Transparent.hh b/src/FbTk/Transparent.hh
index 77e09c5..3720b33 100644
--- a/src/FbTk/Transparent.hh
+++ b/src/FbTk/Transparent.hh
@@ -53,7 +53,7 @@ public:
53 53
54 static bool haveComposite(bool for_real = false); 54 static bool haveComposite(bool for_real = false);
55 static bool haveRender() { if (!s_init) init(); return s_render; } 55 static bool haveRender() { if (!s_init) init(); return s_render; }
56 static void usePseudoTransparent(bool no_composite); 56 static void usePseudoTransparent(bool force);
57 57
58private: 58private:
59 void freeAlpha(); 59 void freeAlpha();
@@ -67,6 +67,7 @@ private:
67 static bool s_init; 67 static bool s_init;
68 static bool s_render; ///< wheter we have RENDER support 68 static bool s_render; ///< wheter we have RENDER support
69 static bool s_composite; ///< wheter we have Composite support 69 static bool s_composite; ///< wheter we have Composite support
70 static bool s_use_composite; ///< whether or not to use Composite
70 static void init(); 71 static void init();
71}; 72};
72 73