aboutsummaryrefslogtreecommitdiff
path: root/src/WinButton.cc
diff options
context:
space:
mode:
authorrathnor <rathnor>2004-01-10 00:37:35 (GMT)
committerrathnor <rathnor>2004-01-10 00:37:35 (GMT)
commit5e87ca1ea430fe325d58d388af2543783e6dd640 (patch)
treeeb888542f5266889f9a49f294d077f68ceb2d40b /src/WinButton.cc
parent7b4e2364bf3d6feaf783999e173955829dfc9328 (diff)
downloadfluxbox-5e87ca1ea430fe325d58d388af2543783e6dd640.zip
fluxbox-5e87ca1ea430fe325d58d388af2543783e6dd640.tar.bz2
fix some minor transparency issues
Diffstat (limited to 'src/WinButton.cc')
-rw-r--r--src/WinButton.cc37
1 files changed, 21 insertions, 16 deletions
diff --git a/src/WinButton.cc b/src/WinButton.cc
index 900d23e..6af0dae 100644
--- a/src/WinButton.cc
+++ b/src/WinButton.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22/// $Id: WinButton.cc,v 1.16 2003/10/31 19:32:40 rathnor Exp $ 22/// $Id: WinButton.cc,v 1.17 2004/01/10 00:37:35 rathnor Exp $
23 23
24#include "WinButton.hh" 24#include "WinButton.hh"
25#include "App.hh" 25#include "App.hh"
@@ -39,15 +39,17 @@ WinButton::WinButton(const FluxboxWindow &listen_to,
39 39
40void WinButton::exposeEvent(XExposeEvent &event) { 40void WinButton::exposeEvent(XExposeEvent &event) {
41 FbTk::Button::exposeEvent(event); 41 FbTk::Button::exposeEvent(event);
42 drawType(); 42 drawType(false, false);
43} 43}
44 44
45void WinButton::buttonReleaseEvent(XButtonEvent &event) { 45void WinButton::buttonReleaseEvent(XButtonEvent &event) {
46 FbTk::Button::buttonReleaseEvent(event); 46 FbTk::Button::buttonReleaseEvent(event);
47 clear(); 47 clear();
48 updateTransparent();
48} 49}
49 50
50void WinButton::drawType() { 51// clear is used to force this to clear the window (e.g. called from clear())
52void WinButton::drawType(bool clear, bool no_trans) {
51 bool used = false; 53 bool used = false;
52 54
53 // if it's odd and we're centring, we need to add one 55 // if it's odd and we're centring, we need to add one
@@ -79,13 +81,14 @@ void WinButton::drawType() {
79 used = true; 81 used = true;
80 } 82 }
81 } 83 }
82 if (used) 84 if (used || clear)
83 FbTk::FbWindow::clear(); 85 FbTk::FbWindow::clear();
84 86
85 // if no pixmap was used, use old style 87 // if no pixmap was used, use old style
86 if (!used) { 88 if (!used) {
87 if (gc() == 0) // must have valid graphic context 89 if (gc() == 0) // must have valid graphic context
88 return; 90 return;
91
89 drawRectangle(gc(), 92 drawRectangle(gc(),
90 2, 2, width() - 5, height() - 5); 93 2, 2, width() - 5, height() - 5);
91 drawLine(gc(), 94 drawLine(gc(),
@@ -120,9 +123,10 @@ void WinButton::drawType() {
120 123
121 } 124 }
122 125
123 if (used) { 126 if (used || clear) {
124 FbTk::FbWindow::clear(); 127 FbTk::FbWindow::clear();
125 } else if (gc() != 0) { // must have valid graphic context 128 }
129 if (!used && gc() != 0) { // must have valid graphic context
126 FbTk::FbWindow::drawRectangle(gc(), 130 FbTk::FbWindow::drawRectangle(gc(),
127 2, height() - 5, width() - 5, 2); 131 2, height() - 5, width() - 5, 2);
128 } 132 }
@@ -178,9 +182,10 @@ void WinButton::drawType() {
178 182
179 } 183 }
180 184
181 if (used) 185 if (used || clear)
182 FbTk::FbWindow::clear(); 186 FbTk::FbWindow::clear();
183 else if (gc() != 0) { 187
188 if (!used && gc() != 0) {
184 // width/4 != width/2, so we use /4*2 so that it's properly centred 189 // width/4 != width/2, so we use /4*2 so that it's properly centred
185 if (m_listen_to.isStuck()) { 190 if (m_listen_to.isStuck()) {
186 fillRectangle(gc(), 191 fillRectangle(gc(),
@@ -221,9 +226,10 @@ void WinButton::drawType() {
221 } 226 }
222 227
223 228
224 if (used) 229 if (used || clear)
225 FbTk::FbWindow::clear(); 230 FbTk::FbWindow::clear();
226 else if (gc() != 0) { // must have valid graphic context 231
232 if (!used && gc() != 0) { // must have valid graphic context
227 233
228 drawLine(gc(), 234 drawLine(gc(),
229 2, 2, 235 2, 2,
@@ -265,20 +271,19 @@ void WinButton::drawType() {
265 } 271 }
266 } 272 }
267 273
268 274 if (used || clear)
269 FbTk::FbWindow::clear(); 275 FbTk::FbWindow::clear();
270 276
271 break; 277 break;
272 } 278 }
273 updateTransparent(); 279 if ((used || clear) && !no_trans)
280 updateTransparent();
274} 281}
275 282
276void WinButton::clear() { 283void WinButton::clear() {
277 FbTk::Button::clear(); 284 drawType(true, true);
278 drawType();
279} 285}
280 286
281void WinButton::update(FbTk::Subject *subj) { 287void WinButton::update(FbTk::Subject *subj) {
282 clear(); 288 clear();
283 drawType();
284} 289}