diff options
author | fluxgen <fluxgen> | 2003-09-10 09:53:21 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-09-10 09:53:21 (GMT) |
commit | 37c8e349fbec21889abcb1a2f04452982cd35cbc (patch) | |
tree | b16d459881f262bc55aad1c74c561ec0c330af53 | |
parent | 7df61abcbd9c0e533ad34d55d6e42e7a22b0b024 (diff) | |
download | fluxbox-37c8e349fbec21889abcb1a2f04452982cd35cbc.zip fluxbox-37c8e349fbec21889abcb1a2f04452982cd35cbc.tar.bz2 |
fixed timer to update transparent while moving
-rw-r--r-- | src/FbWinFrame.cc | 63 | ||||
-rw-r--r-- | src/FbWinFrame.hh | 24 |
2 files changed, 54 insertions, 33 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index 37d0c0b..c546d54 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.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: FbWinFrame.cc,v 1.43 2003/08/25 16:17:18 fluxgen Exp $ | 22 | // $Id: FbWinFrame.cc,v 1.44 2003/09/10 09:53:21 fluxgen Exp $ |
23 | 23 | ||
24 | #include "FbWinFrame.hh" | 24 | #include "FbWinFrame.hh" |
25 | 25 | ||
@@ -28,6 +28,7 @@ | |||
28 | #include "FbTk/TextButton.hh" | 28 | #include "FbTk/TextButton.hh" |
29 | #include "FbTk/App.hh" | 29 | #include "FbTk/App.hh" |
30 | #include "FbTk/Compose.hh" | 30 | #include "FbTk/Compose.hh" |
31 | #include "FbTk/SimpleCommand.hh" | ||
31 | 32 | ||
32 | #include "FbWinFrameTheme.hh" | 33 | #include "FbWinFrameTheme.hh" |
33 | #ifdef SHAPE | 34 | #ifdef SHAPE |
@@ -169,26 +170,12 @@ void FbWinFrame::move(int x, int y) { | |||
169 | if (theme().alpha() == 255) | 170 | if (theme().alpha() == 255) |
170 | return; | 171 | return; |
171 | 172 | ||
172 | redrawTitlebar(); | 173 | // restart update timer |
174 | m_update_timer.start(); | ||
173 | 175 | ||
174 | ButtonList::iterator btn_it = m_buttons_left.begin(); | 176 | /* |
175 | ButtonList::iterator btn_it_end = m_buttons_left.begin(); | 177 | |
176 | for (; btn_it != btn_it_end; ++btn_it) { | 178 | */ |
177 | (*btn_it)->clear(); | ||
178 | (*btn_it)->updateTransparent(); | ||
179 | } | ||
180 | btn_it = m_buttons_right.begin(); | ||
181 | btn_it_end = m_buttons_right.end(); | ||
182 | for (; btn_it != btn_it_end; ++btn_it) { | ||
183 | (*btn_it)->clear(); | ||
184 | (*btn_it)->updateTransparent(); | ||
185 | } | ||
186 | m_grip_left.clear(); | ||
187 | m_grip_right.clear(); | ||
188 | m_handle.clear(); | ||
189 | m_grip_left.updateTransparent(); | ||
190 | m_grip_right.updateTransparent(); | ||
191 | m_handle.updateTransparent(); | ||
192 | } | 179 | } |
193 | 180 | ||
194 | void FbWinFrame::resize(unsigned int width, unsigned int height) { | 181 | void FbWinFrame::resize(unsigned int width, unsigned int height) { |
@@ -219,7 +206,8 @@ void FbWinFrame::resizeForClient(unsigned int width, unsigned int height) { | |||
219 | 206 | ||
220 | void FbWinFrame::moveResize(int x, int y, unsigned int width, unsigned int height) { | 207 | void FbWinFrame::moveResize(int x, int y, unsigned int width, unsigned int height) { |
221 | move(x, y); | 208 | move(x, y); |
222 | resize(width, height); | 209 | if (width != FbWinFrame::width() || height != FbWinFrame::height()) |
210 | resize(width, height); | ||
223 | } | 211 | } |
224 | 212 | ||
225 | void FbWinFrame::setTitle(const std::string &titletext) { | 213 | void FbWinFrame::setTitle(const std::string &titletext) { |
@@ -699,7 +687,8 @@ void FbWinFrame::redrawTitle() { | |||
699 | (*btn_it)->clear(); | 687 | (*btn_it)->clear(); |
700 | (*btn_it)->updateTransparent(); | 688 | (*btn_it)->updateTransparent(); |
701 | } | 689 | } |
702 | 690 | m_titlebar.clear(); | |
691 | m_label.clear(); | ||
703 | } | 692 | } |
704 | 693 | ||
705 | void FbWinFrame::redrawTitlebar() { | 694 | void FbWinFrame::redrawTitlebar() { |
@@ -894,6 +883,12 @@ void FbWinFrame::renderButtons() { | |||
894 | } | 883 | } |
895 | 884 | ||
896 | void FbWinFrame::init() { | 885 | void FbWinFrame::init() { |
886 | // setup update timer | ||
887 | FbTk::RefCount<FbTk::Command> update_transp(new FbTk::SimpleCommand<FbWinFrame>(*this, | ||
888 | &FbWinFrame::updateTransparent)); | ||
889 | m_update_timer.setCommand(update_transp); | ||
890 | m_update_timer.setTimeout(10L); | ||
891 | m_update_timer.fireOnce(true); | ||
897 | 892 | ||
898 | m_disable_shape = false; | 893 | m_disable_shape = false; |
899 | 894 | ||
@@ -979,13 +974,13 @@ void FbWinFrame::getCurrentFocusPixmap(Pixmap &label_pm, Pixmap &title_pm, | |||
979 | title_color = m_title_focused_color; | 974 | title_color = m_title_focused_color; |
980 | 975 | ||
981 | } else { | 976 | } else { |
982 | getUnFocusPixmap(label_pm, title_pm, | 977 | getUnfocusPixmap(label_pm, title_pm, |
983 | label_color, title_color); | 978 | label_color, title_color); |
984 | } | 979 | } |
985 | 980 | ||
986 | } | 981 | } |
987 | 982 | ||
988 | void FbWinFrame::getUnFocusPixmap(Pixmap &label_pm, Pixmap &title_pm, | 983 | void FbWinFrame::getUnfocusPixmap(Pixmap &label_pm, Pixmap &title_pm, |
989 | FbTk::Color &label_color, | 984 | FbTk::Color &label_color, |
990 | FbTk::Color &title_color) { | 985 | FbTk::Color &title_color) { |
991 | if (m_label_unfocused_pm != 0) { | 986 | if (m_label_unfocused_pm != 0) { |
@@ -1086,4 +1081,24 @@ void FbWinFrame::renderButtonUnfocus(FbTk::TextButton &button) { | |||
1086 | button.clear(); | 1081 | button.clear(); |
1087 | } | 1082 | } |
1088 | 1083 | ||
1084 | void FbWinFrame::updateTransparent() { | ||
1085 | redrawTitlebar(); | ||
1086 | |||
1087 | ButtonList::iterator button_it = m_buttons_left.begin(); | ||
1088 | ButtonList::iterator button_it_end = m_buttons_left.begin(); | ||
1089 | for (; button_it != button_it_end; ++button_it) { | ||
1090 | (*button_it)->clear(); | ||
1091 | (*button_it)->updateTransparent(); | ||
1092 | } | ||
1089 | 1093 | ||
1094 | button_it = m_buttons_right.begin(); | ||
1095 | button_it_end = m_buttons_right.end(); | ||
1096 | for (; button_it != button_it_end; ++button_it) { | ||
1097 | (*button_it)->clear(); | ||
1098 | (*button_it)->updateTransparent(); | ||
1099 | } | ||
1100 | |||
1101 | m_grip_left.updateTransparent(); | ||
1102 | m_grip_right.updateTransparent(); | ||
1103 | m_handle.updateTransparent(); | ||
1104 | } | ||
diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh index 5832924..854701b 100644 --- a/src/FbWinFrame.hh +++ b/src/FbWinFrame.hh | |||
@@ -19,17 +19,18 @@ | |||
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: FbWinFrame.hh,v 1.14 2003/08/24 15:18:09 fluxgen Exp $ | 22 | // $Id: FbWinFrame.hh,v 1.15 2003/09/10 09:53:21 fluxgen Exp $ |
23 | 23 | ||
24 | #ifndef FBWINFRAME_HH | 24 | #ifndef FBWINFRAME_HH |
25 | #define FBWINFRAME_HH | 25 | #define FBWINFRAME_HH |
26 | 26 | ||
27 | #include "FbWindow.hh" | 27 | #include "FbTk/FbWindow.hh" |
28 | #include "EventHandler.hh" | 28 | #include "FbTk/EventHandler.hh" |
29 | #include "RefCount.hh" | 29 | #include "FbTk/RefCount.hh" |
30 | #include "Observer.hh" | 30 | #include "FbTk/Observer.hh" |
31 | #include "Color.hh" | 31 | #include "FbTk/Color.hh" |
32 | #include "FbPixmap.hh" | 32 | #include "FbTk/FbPixmap.hh" |
33 | #include "FbTk/Timer.hh" | ||
33 | 34 | ||
34 | #include <vector> | 35 | #include <vector> |
35 | #include <list> | 36 | #include <list> |
@@ -112,7 +113,7 @@ public: | |||
112 | void setEventHandler(FbTk::EventHandler &evh); | 113 | void setEventHandler(FbTk::EventHandler &evh); |
113 | /// remove any handler for the windows | 114 | /// remove any handler for the windows |
114 | void removeEventHandler(); | 115 | void removeEventHandler(); |
115 | 116 | ||
116 | void hideTitlebar(); | 117 | void hideTitlebar(); |
117 | void showTitlebar(); | 118 | void showTitlebar(); |
118 | void hideHandle(); | 119 | void hideHandle(); |
@@ -135,6 +136,9 @@ public: | |||
135 | 136 | ||
136 | void reconfigure(); | 137 | void reconfigure(); |
137 | void setUseShape(bool value); | 138 | void setUseShape(bool value); |
139 | |||
140 | void setUpdateDelayTime(long t) { m_update_timer.setTimeout(t); } | ||
141 | |||
138 | /** | 142 | /** |
139 | @name accessors | 143 | @name accessors |
140 | */ | 144 | */ |
@@ -188,7 +192,7 @@ private: | |||
188 | /// renders to pixmap or sets color | 192 | /// renders to pixmap or sets color |
189 | void render(const FbTk::Texture &tex, FbTk::Color &col, Pixmap &pm, | 193 | void render(const FbTk::Texture &tex, FbTk::Color &col, Pixmap &pm, |
190 | unsigned int width, unsigned int height); | 194 | unsigned int width, unsigned int height); |
191 | void getUnFocusPixmap(Pixmap &label_pm, Pixmap &title_pm, | 195 | void getUnfocusPixmap(Pixmap &label_pm, Pixmap &title_pm, |
192 | FbTk::Color &label_color, FbTk::Color &title_color); | 196 | FbTk::Color &label_color, FbTk::Color &title_color); |
193 | void getCurrentFocusPixmap(Pixmap &label_pm, Pixmap &title_pm, | 197 | void getCurrentFocusPixmap(Pixmap &label_pm, Pixmap &title_pm, |
194 | FbTk::Color &label_color, FbTk::Color &title_color); | 198 | FbTk::Color &label_color, FbTk::Color &title_color); |
@@ -199,6 +203,7 @@ private: | |||
199 | void init(); | 203 | void init(); |
200 | /// initiate inserted buttons for current theme | 204 | /// initiate inserted buttons for current theme |
201 | void setupButton(FbTk::Button &btn); | 205 | void setupButton(FbTk::Button &btn); |
206 | void updateTransparent(); | ||
202 | 207 | ||
203 | FbWinFrameTheme &m_theme; ///< theme to be used | 208 | FbWinFrameTheme &m_theme; ///< theme to be used |
204 | FbTk::ImageControl &m_imagectrl; ///< Image control for rendering | 209 | FbTk::ImageControl &m_imagectrl; ///< Image control for rendering |
@@ -282,6 +287,7 @@ private: | |||
282 | ThemeListener m_themelistener; | 287 | ThemeListener m_themelistener; |
283 | std::auto_ptr<Shape> m_shape; | 288 | std::auto_ptr<Shape> m_shape; |
284 | bool m_disable_shape; | 289 | bool m_disable_shape; |
290 | FbTk::Timer m_update_timer; | ||
285 | }; | 291 | }; |
286 | 292 | ||
287 | #endif // FBWINFRAME_HH | 293 | #endif // FBWINFRAME_HH |