summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-09-14 10:32:31 (GMT)
committerfluxgen <fluxgen>2003-09-14 10:32:31 (GMT)
commit32a6aa1f54bbb32f358cfa543288ac6ae33409a4 (patch)
tree37838ca302bf92f1caab777fe04353c2d3508578
parentce1852c29324e921363882da2f6cb7c24b656fe4 (diff)
downloadfluxbox_lack-32a6aa1f54bbb32f358cfa543288ac6ae33409a4.zip
fluxbox_lack-32a6aa1f54bbb32f358cfa543288ac6ae33409a4.tar.bz2
less flicker
-rw-r--r--src/FbWinFrame.cc81
-rw-r--r--src/FbWinFrame.hh5
2 files changed, 43 insertions, 43 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index 81ba7de..ef54cb1 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.50 2003/09/12 23:38:50 fluxgen Exp $ 22// $Id: FbWinFrame.cc,v 1.51 2003/09/14 10:32:31 fluxgen Exp $
23 23
24#include "FbWinFrame.hh" 24#include "FbWinFrame.hh"
25 25
@@ -212,24 +212,19 @@ void FbWinFrame::moveResize(int x, int y, unsigned int width, unsigned int heigh
212 resize(width, height); 212 resize(width, height);
213} 213}
214 214
215void FbWinFrame::setTitle(const std::string &titletext) {
216 m_titletext = titletext;
217 redrawTitle();
218}
219
220void FbWinFrame::setFocus(bool newvalue) { 215void FbWinFrame::setFocus(bool newvalue) {
221 if (m_focused == newvalue) // no need to change focus 216 if (m_focused == newvalue)
222 return; 217 return;
223 218
224 219 if (currentLabel()) {
225 220 if (newvalue) // focused
226 if (m_focused && !newvalue && currentLabel()) { 221 renderButtonFocus(*m_current_label);
227 renderButtonUnfocus(*m_current_label); 222 else // unfocused
228 } else if (!m_focused && newvalue && currentLabel()) { 223 renderButtonUnfocus(*m_current_label);
229 renderButtonFocus(*m_current_label);
230 } 224 }
231 225
232 m_focused = newvalue; 226 m_focused = newvalue;
227
233 renderButtons(); 228 renderButtons();
234 renderHandles(); 229 renderHandles();
235} 230}
@@ -243,7 +238,7 @@ void FbWinFrame::addLeftButton(FbTk::Button *btn) {
243 return; 238 return;
244 239
245 setupButton(*btn); // setup theme and other stuff 240 setupButton(*btn); // setup theme and other stuff
246 241
247 m_buttons_left.push_back(btn); 242 m_buttons_left.push_back(btn);
248} 243}
249 244
@@ -332,13 +327,14 @@ void FbWinFrame::moveLabelButtonRight(const FbTk::TextButton &btn) {
332} 327}
333 328
334void FbWinFrame::setLabelButtonFocus(FbTk::TextButton &btn) { 329void FbWinFrame::setLabelButtonFocus(FbTk::TextButton &btn) {
330 if (&btn == currentLabel())
331 return;
335 LabelList::iterator it = find(m_labelbuttons.begin(), 332 LabelList::iterator it = find(m_labelbuttons.begin(),
336 m_labelbuttons.end(), 333 m_labelbuttons.end(),
337 &btn); 334 &btn);
338 if (it == m_labelbuttons.end()) 335 if (it == m_labelbuttons.end())
339 return; 336 return;
340 337
341
342 // render label buttons 338 // render label buttons
343 if (currentLabel() != 0) 339 if (currentLabel() != 0)
344 renderButtonUnfocus(*m_current_label); 340 renderButtonUnfocus(*m_current_label);
@@ -703,13 +699,16 @@ void FbWinFrame::redrawTitle() {
703 (*btn_it)->moveResize(last_x - border_width, - border_width, 699 (*btn_it)->moveResize(last_x - border_width, - border_width,
704 button_width, 700 button_width,
705 label().height() + border_width); 701 label().height() + border_width);
706 (*btn_it)->clear(); 702 if (isVisible())
707 (*btn_it)->updateTransparent(); 703 (*btn_it)->clear();
704 }
705
706 if (isVisible()) {
707 m_titlebar.clear();
708 m_titlebar.updateTransparent();
709 m_label.clear();
710 m_label.updateTransparent();
708 } 711 }
709 m_titlebar.clear();
710 m_titlebar.updateTransparent();
711 m_label.clear();
712 m_label.updateTransparent();
713} 712}
714 713
715void FbWinFrame::redrawTitlebar() { 714void FbWinFrame::redrawTitlebar() {
@@ -868,15 +867,9 @@ void FbWinFrame::renderHandles() {
868 } 867 }
869 } 868 }
870 869
871 m_grip_left.clear();
872 m_grip_left.setAlpha(theme().alpha()); 870 m_grip_left.setAlpha(theme().alpha());
873 m_grip_left.updateTransparent();
874 m_grip_right.clear();
875 m_grip_right.setAlpha(theme().alpha()); 871 m_grip_right.setAlpha(theme().alpha());
876 m_grip_right.updateTransparent();
877 m_handle.clear();
878 m_handle.setAlpha(theme().alpha()); 872 m_handle.setAlpha(theme().alpha());
879 m_handle.updateTransparent();
880 873
881} 874}
882 875
@@ -885,7 +878,7 @@ void FbWinFrame::renderButtons() {
885 878
886 render(m_theme.buttonFocusTexture(), m_button_color, m_button_pm, 879 render(m_theme.buttonFocusTexture(), m_button_color, m_button_pm,
887 m_button_size, m_button_size); 880 m_button_size, m_button_size);
888 881
889 render(m_theme.buttonUnfocusTexture(), m_button_unfocused_color, 882 render(m_theme.buttonUnfocusTexture(), m_button_unfocused_color,
890 m_button_unfocused_pm, 883 m_button_unfocused_pm,
891 m_button_size, m_button_size); 884 m_button_size, m_button_size);
@@ -895,12 +888,22 @@ void FbWinFrame::renderButtons() {
895 m_button_size, m_button_size); 888 m_button_size, m_button_size);
896 889
897 // setup left and right buttons 890 // setup left and right buttons
898 for (size_t i=0; i < m_buttons_left.size(); ++i) 891 for (size_t i=0; i < m_buttons_left.size(); ++i) {
899 setupButton(*m_buttons_left[i]); 892 setupButton(*m_buttons_left[i]);
893 if (isVisible()) {
894 m_buttons_left[i]->clear();
895 m_buttons_left[i]->updateTransparent();
896 }
897 }
900 898
901 for (size_t i=0; i < m_buttons_right.size(); ++i) 899 for (size_t i=0; i < m_buttons_right.size(); ++i) {
902 setupButton(*m_buttons_right[i]); 900 setupButton(*m_buttons_right[i]);
903 901 if (isVisible()) {
902 m_buttons_right[i]->clear();
903 m_buttons_right[i]->updateTransparent();
904 }
905 }
906
904} 907}
905 908
906void FbWinFrame::init() { 909void FbWinFrame::init() {
@@ -935,36 +938,33 @@ void FbWinFrame::init() {
935 // Note: we don't show clientarea yet 938 // Note: we don't show clientarea yet
936 939
937 setEventHandler(*this); 940 setEventHandler(*this);
938 // reconfigure();
939} 941}
940 942
941/** 943/**
942 Setups upp background, pressed pixmap/color of the button to current theme 944 Setups upp background, pressed pixmap/color of the button to current theme
943*/ 945*/
944void FbWinFrame::setupButton(FbTk::Button &btn) { 946void FbWinFrame::setupButton(FbTk::Button &btn) {
945 if (m_button_pressed_pm) { 947 if (m_button_pressed_pm)
946 btn.setPressedPixmap(m_button_pressed_pm); 948 btn.setPressedPixmap(m_button_pressed_pm);
947 }
948 949
949 //!! TODO button pressed color 950 //!! TODO button pressed color
950 951
951 if (m_focused) { 952 if (focused()) { // focused
952 btn.setGC(m_theme.buttonPicFocusGC()); 953 btn.setGC(m_theme.buttonPicFocusGC());
953 if (m_button_pm) 954 if (m_button_pm)
954 btn.setBackgroundPixmap(m_button_pm); 955 btn.setBackgroundPixmap(m_button_pm);
955 else 956 else
956 btn.setBackgroundColor(m_button_color); 957 btn.setBackgroundColor(m_button_color);
957 } else { 958 } else { // unfocused
958 btn.setGC(m_theme.buttonPicUnfocusGC()); 959 btn.setGC(m_theme.buttonPicUnfocusGC());
959 if (m_button_unfocused_pm) 960 if (m_button_unfocused_pm)
960 btn.setBackgroundPixmap(m_button_unfocused_pm); 961 btn.setBackgroundPixmap(m_button_unfocused_pm);
961 else 962 else
962 btn.setBackgroundColor(m_button_color); 963 btn.setBackgroundColor(m_button_unfocused_color);
963 964
964 } 965 }
965 966
966 btn.setAlpha(theme().alpha()); 967 btn.setAlpha(theme().alpha());
967 btn.clear();
968} 968}
969 969
970void FbWinFrame::render(const FbTk::Texture &tex, FbTk::Color &col, Pixmap &pm, 970void FbWinFrame::render(const FbTk::Texture &tex, FbTk::Color &col, Pixmap &pm,
@@ -1089,7 +1089,6 @@ void FbWinFrame::renderButtonFocus(FbTk::TextButton &button) {
1089 button.setBackgroundColor(m_label_focused_color); 1089 button.setBackgroundColor(m_label_focused_color);
1090 1090
1091 button.clear(); 1091 button.clear();
1092 button.updateTransparent();
1093} 1092}
1094 1093
1095void FbWinFrame::renderButtonUnfocus(FbTk::TextButton &button) { 1094void FbWinFrame::renderButtonUnfocus(FbTk::TextButton &button) {
@@ -1107,7 +1106,6 @@ void FbWinFrame::renderButtonUnfocus(FbTk::TextButton &button) {
1107 button.setBackgroundColor(m_label_unfocused_color); 1106 button.setBackgroundColor(m_label_unfocused_color);
1108 1107
1109 button.clear(); 1108 button.clear();
1110 button.updateTransparent();
1111} 1109}
1112 1110
1113void FbWinFrame::updateTransparent() { 1111void FbWinFrame::updateTransparent() {
@@ -1127,8 +1125,11 @@ void FbWinFrame::updateTransparent() {
1127 (*button_it)->updateTransparent(); 1125 (*button_it)->updateTransparent();
1128 } 1126 }
1129 1127
1128 m_grip_left.clear();
1130 m_grip_left.updateTransparent(); 1129 m_grip_left.updateTransparent();
1130 m_grip_right.clear();
1131 m_grip_right.updateTransparent(); 1131 m_grip_right.updateTransparent();
1132 m_handle.clear();
1132 m_handle.updateTransparent(); 1133 m_handle.updateTransparent();
1133} 1134}
1134 1135
diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh
index 70ecaf0..23b004b 100644
--- a/src/FbWinFrame.hh
+++ b/src/FbWinFrame.hh
@@ -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.hh,v 1.19 2003/09/12 23:38:50 fluxgen Exp $ 22// $Id: FbWinFrame.hh,v 1.20 2003/09/14 10:32:31 fluxgen Exp $
23 23
24#ifndef FBWINFRAME_HH 24#ifndef FBWINFRAME_HH
25#define FBWINFRAME_HH 25#define FBWINFRAME_HH
@@ -81,8 +81,7 @@ public:
81 /// resize client to specified size and resize frame to it 81 /// resize client to specified size and resize frame to it
82 void resizeForClient(unsigned int width, unsigned int height); 82 void resizeForClient(unsigned int width, unsigned int height);
83 void moveResize(int x, int y, unsigned int width, unsigned int height); 83 void moveResize(int x, int y, unsigned int width, unsigned int height);
84 /// sets title on the titlebar label 84
85 void setTitle(const std::string &title);
86 /// set focus/unfocus style 85 /// set focus/unfocus style
87 void setFocus(bool newvalue); 86 void setFocus(bool newvalue);
88 void setDoubleClickTime(unsigned int time); 87 void setDoubleClickTime(unsigned int time);