summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-09-10 21:24:36 (GMT)
committerfluxgen <fluxgen>2003-09-10 21:24:36 (GMT)
commita963aeacebe0c5239576e9073c896f15abba05b1 (patch)
treecb50dc8a4f2c2d54367ae67384bb2e123e7bc7a1
parent7c479799e4682c872f917e1c1ac554d17511822c (diff)
downloadfluxbox_lack-a963aeacebe0c5239576e9073c896f15abba05b1.zip
fluxbox_lack-a963aeacebe0c5239576e9073c896f15abba05b1.tar.bz2
fixed exposeEvent flicker and bug in setBackgroundColor
-rw-r--r--src/FbTk/Button.cc21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/FbTk/Button.cc b/src/FbTk/Button.cc
index 880d6ce..bcbde70 100644
--- a/src/FbTk/Button.cc
+++ b/src/FbTk/Button.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: Button.cc,v 1.14 2003/09/10 11:19:39 fluxgen Exp $ 22// $Id: Button.cc,v 1.15 2003/09/10 21:24:36 fluxgen Exp $
23 23
24#include "Button.hh" 24#include "Button.hh"
25 25
@@ -57,7 +57,7 @@ Button::Button(const FbWindow &parent, int x, int y,
57} 57}
58 58
59Button::~Button() { 59Button::~Button() {
60 FbTk::EventManager::instance()->remove(*this); 60
61} 61}
62 62
63void Button::setOnClick(RefCount<Command> &cmd, int button) { 63void Button::setOnClick(RefCount<Command> &cmd, int button) {
@@ -77,6 +77,7 @@ void Button::setPressedPixmap(Pixmap pm) {
77} 77}
78 78
79void Button::setBackgroundColor(const Color &color) { 79void Button::setBackgroundColor(const Color &color) {
80 m_background_pm = 0; // we're using background color now
80 m_background_color = color; 81 m_background_color = color;
81 FbTk::FbWindow::setBackgroundColor(color); 82 FbTk::FbWindow::setBackgroundColor(color);
82} 83}
@@ -91,15 +92,15 @@ void Button::buttonPressEvent(XButtonEvent &event) {
91 FbWindow::setBackgroundPixmap(m_pressed_pm); 92 FbWindow::setBackgroundPixmap(m_pressed_pm);
92 m_pressed = true; 93 m_pressed = true;
93 clear(); 94 clear();
94 FbWindow::updateTransparent(); 95 updateTransparent();
95} 96}
96 97
97void Button::buttonReleaseEvent(XButtonEvent &event) { 98void Button::buttonReleaseEvent(XButtonEvent &event) {
98 m_pressed = false; 99 m_pressed = false;
99 if (m_background_pm) 100 if (m_background_pm)
100 FbWindow::setBackgroundPixmap(m_background_pm); 101 setBackgroundPixmap(m_background_pm);
101 else 102 else
102 FbWindow::setBackgroundColor(m_background_color); 103 setBackgroundColor(m_background_color);
103 104
104 clear(); // clear background 105 clear(); // clear background
105 106
@@ -112,7 +113,7 @@ void Button::buttonReleaseEvent(XButtonEvent &event) {
112 XCopyArea(disp, m_foreground_pm, window(), m_gc, 0, 0, width(), height(), 0, 0); 113 XCopyArea(disp, m_foreground_pm, window(), m_gc, 0, 0, width(), height(), 0, 0);
113 } 114 }
114 115
115 FbWindow::updateTransparent(); 116 updateTransparent();
116 117
117 // finaly, execute command (this must be done last since this object might be deleted by the command) 118 // finaly, execute command (this must be done last since this object might be deleted by the command)
118 if (event.button > 0 && event.button <= 5 && 119 if (event.button > 0 && event.button <= 5 &&
@@ -126,12 +127,12 @@ void Button::buttonReleaseEvent(XButtonEvent &event) {
126 127
127void Button::exposeEvent(XExposeEvent &event) { 128void Button::exposeEvent(XExposeEvent &event) {
128 if (m_background_pm) 129 if (m_background_pm)
129 FbWindow::setBackgroundPixmap(m_background_pm); 130 setBackgroundPixmap(m_background_pm);
130 else 131 else
131 FbWindow::setBackgroundColor(m_background_color); 132 setBackgroundColor(m_background_color);
132 133
133 clear(); 134 clearArea(event.x, event.y, event.width, event.height);
134 FbWindow::updateTransparent(); 135 updateTransparent(event.x, event.y, event.width, event.height);
135} 136}
136 137
137}; // end namespace FbTk 138}; // end namespace FbTk