aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Button.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-08-11 14:40:15 (GMT)
committerfluxgen <fluxgen>2003-08-11 14:40:15 (GMT)
commit1a70e354781520450981a3e656c1f21e319b9765 (patch)
tree17a214969fbbe3c40d0b0f3e48961d5168099a18 /src/FbTk/Button.cc
parent088bb502fbae072db947a81aa14b494849659426 (diff)
downloadfluxbox-1a70e354781520450981a3e656c1f21e319b9765.zip
fluxbox-1a70e354781520450981a3e656c1f21e319b9765.tar.bz2
fixed minor bug in backgroun update
Diffstat (limited to 'src/FbTk/Button.cc')
-rw-r--r--src/FbTk/Button.cc22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/FbTk/Button.cc b/src/FbTk/Button.cc
index 6d2fd21..8b0a478 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.9 2003/08/04 12:46:49 fluxgen Exp $ 22// $Id: Button.cc,v 1.10 2003/08/11 14:40:15 fluxgen Exp $
23 23
24#include "Button.hh" 24#include "Button.hh"
25 25
@@ -89,15 +89,15 @@ void Button::setPressedPixmap(Pixmap pm) {
89} 89}
90 90
91void Button::setBackgroundColor(const Color &color) { 91void Button::setBackgroundColor(const Color &color) {
92 m_win.setBackgroundColor(color); 92 m_background_color = color;
93 m_background_color = color; 93 window().setBackgroundColor(color);
94 clear(); 94 clear();
95 window().updateTransparent(); 95 window().updateTransparent();
96} 96}
97 97
98void Button::setBackgroundPixmap(Pixmap pm) { 98void Button::setBackgroundPixmap(Pixmap pm) {
99 m_win.setBackgroundPixmap(pm);
100 m_background_pm = pm; 99 m_background_pm = pm;
100 window().setBackgroundPixmap(pm);
101 clear(); 101 clear();
102 window().updateTransparent(); 102 window().updateTransparent();
103} 103}
@@ -124,21 +124,18 @@ void Button::buttonReleaseEvent(XButtonEvent &event) {
124 m_win.setBackgroundPixmap(m_background_pm); 124 m_win.setBackgroundPixmap(m_background_pm);
125 else 125 else
126 m_win.setBackgroundColor(m_background_color); 126 m_win.setBackgroundColor(m_background_color);
127
127 clear(); // clear background 128 clear(); // clear background
128 129
129 if (m_foreground_pm) { // draw foreground 130 if (m_foreground_pm) { // draw foreground pixmap
130 Display *disp = App::instance()->display(); 131 Display *disp = App::instance()->display();
131 132
132 if (m_gc == 0) // get default gc 133 if (m_gc == 0) // get default gc if we dont have one
133 m_gc = DefaultGC(disp, m_win.screenNumber()); 134 m_gc = DefaultGC(disp, m_win.screenNumber());
134 135
135 XCopyArea(disp, m_foreground_pm, m_win.window(), m_gc, 0, 0, width(), height(), 0, 0); 136 XCopyArea(disp, m_foreground_pm, m_win.window(), m_gc, 0, 0, width(), height(), 0, 0);
136 } 137 }
137 138
138 if (event.x < 0 || event.y < 0 ||
139 event.x > width() || event.y > height())
140 return;
141
142 if (event.button > 0 && event.button <= 5 && 139 if (event.button > 0 && event.button <= 5 &&
143 m_onclick[event.button -1].get() != 0) 140 m_onclick[event.button -1].get() != 0)
144 m_onclick[event.button - 1]->execute(); 141 m_onclick[event.button - 1]->execute();
@@ -147,6 +144,11 @@ void Button::buttonReleaseEvent(XButtonEvent &event) {
147} 144}
148 145
149void Button::exposeEvent(XExposeEvent &event) { 146void Button::exposeEvent(XExposeEvent &event) {
147 if (m_background_pm)
148 m_win.setBackgroundPixmap(m_background_pm);
149 else
150 m_win.setBackgroundColor(m_background_color);
151
150 clear(); 152 clear();
151 window().updateTransparent(event.x, event.y, event.width, event.height); 153 window().updateTransparent(event.x, event.y, event.width, event.height);
152} 154}