diff options
author | fluxgen <fluxgen> | 2004-02-27 13:24:21 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2004-02-27 13:24:21 (GMT) |
commit | 962669c960cb0a1bffc13306a9ae532f9bb8aa97 (patch) | |
tree | 8d578dee9255bb116bc6c5d245dd92811790c9f5 | |
parent | f1d41e6afa6eb771dc045bd2a8e34de6d9b9c4a6 (diff) | |
download | fluxbox_lack-962669c960cb0a1bffc13306a9ae532f9bb8aa97.zip fluxbox_lack-962669c960cb0a1bffc13306a9ae532f9bb8aa97.tar.bz2 |
improved transparency rendering speed
-rw-r--r-- | src/FbTk/Button.cc | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/src/FbTk/Button.cc b/src/FbTk/Button.cc index f31e6b4..75bda59 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.17 2004/01/08 22:05:12 fluxgen Exp $ | 22 | // $Id: Button.cc,v 1.18 2004/02/27 13:24:21 fluxgen Exp $ |
23 | 23 | ||
24 | #include "Button.hh" | 24 | #include "Button.hh" |
25 | 25 | ||
@@ -94,36 +94,48 @@ void Button::setBackgroundPixmap(Pixmap pm) { | |||
94 | } | 94 | } |
95 | 95 | ||
96 | void Button::buttonPressEvent(XButtonEvent &event) { | 96 | void Button::buttonPressEvent(XButtonEvent &event) { |
97 | if (m_pressed_pm != 0) | 97 | bool update = false; |
98 | if (m_pressed_pm != 0) { | ||
99 | update = true; | ||
98 | FbWindow::setBackgroundPixmap(m_pressed_pm); | 100 | FbWindow::setBackgroundPixmap(m_pressed_pm); |
99 | else if (m_pressed_color.isAllocated()) | 101 | } else if (m_pressed_color.isAllocated()) { |
102 | update = true; | ||
100 | FbWindow::setBackgroundColor(m_pressed_color); | 103 | FbWindow::setBackgroundColor(m_pressed_color); |
104 | } | ||
101 | 105 | ||
102 | m_pressed = true; | 106 | m_pressed = true; |
103 | clear(); | 107 | if (update) { |
104 | updateTransparent(); | 108 | clear(); |
109 | } | ||
105 | } | 110 | } |
106 | 111 | ||
107 | void Button::buttonReleaseEvent(XButtonEvent &event) { | 112 | void Button::buttonReleaseEvent(XButtonEvent &event) { |
108 | m_pressed = false; | 113 | m_pressed = false; |
109 | if (m_background_pm) | 114 | bool update = false; |
110 | setBackgroundPixmap(m_background_pm); | 115 | if (m_background_pm) { |
111 | else | 116 | if (m_pressed_pm != 0) { |
117 | update = true; | ||
118 | setBackgroundPixmap(m_background_pm); | ||
119 | } | ||
120 | } else if (m_pressed_color.isAllocated()) { | ||
121 | update = true; | ||
112 | setBackgroundColor(m_background_color); | 122 | setBackgroundColor(m_background_color); |
123 | } | ||
113 | 124 | ||
114 | clear(); // clear background | 125 | if (update) { |
126 | clear(); // clear background | ||
115 | 127 | ||
116 | if (m_foreground_pm) { // draw foreground pixmap | 128 | if (m_foreground_pm) { // draw foreground pixmap |
117 | Display *disp = App::instance()->display(); | 129 | Display *disp = App::instance()->display(); |
118 | 130 | ||
119 | if (m_gc == 0) // get default gc if we dont have one | 131 | if (m_gc == 0) // get default gc if we dont have one |
120 | m_gc = DefaultGC(disp, screenNumber()); | 132 | m_gc = DefaultGC(disp, screenNumber()); |
133 | |||
134 | XCopyArea(disp, m_foreground_pm, window(), m_gc, 0, 0, width(), height(), 0, 0); | ||
135 | } | ||
121 | 136 | ||
122 | XCopyArea(disp, m_foreground_pm, window(), m_gc, 0, 0, width(), height(), 0, 0); | ||
123 | } | 137 | } |
124 | 138 | ||
125 | updateTransparent(); | ||
126 | |||
127 | // finaly, execute command (this must be done last since this object might be deleted by the command) | 139 | // finaly, execute command (this must be done last since this object might be deleted by the command) |
128 | if (event.button > 0 && event.button <= 5 && | 140 | if (event.button > 0 && event.button <= 5 && |
129 | event.x > 0 && event.x < static_cast<signed>(width()) && | 141 | event.x > 0 && event.x < static_cast<signed>(width()) && |
@@ -135,13 +147,14 @@ void Button::buttonReleaseEvent(XButtonEvent &event) { | |||
135 | } | 147 | } |
136 | 148 | ||
137 | void Button::exposeEvent(XExposeEvent &event) { | 149 | void Button::exposeEvent(XExposeEvent &event) { |
150 | /* | ||
138 | if (m_background_pm) | 151 | if (m_background_pm) |
139 | setBackgroundPixmap(m_background_pm); | 152 | setBackgroundPixmap(m_background_pm); |
140 | else | 153 | else |
141 | setBackgroundColor(m_background_color); | 154 | setBackgroundColor(m_background_color); |
142 | 155 | */ | |
143 | clearArea(event.x, event.y, event.width, event.height); | 156 | clearArea(event.x, event.y, event.width, event.height); |
144 | updateTransparent(event.x, event.y, event.width, event.height); | 157 | // updateTransparent(event.x, event.y, event.width, event.height); |
145 | } | 158 | } |
146 | 159 | ||
147 | }; // end namespace FbTk | 160 | }; // end namespace FbTk |