aboutsummaryrefslogtreecommitdiff
path: root/src/FbWinFrame.cc
diff options
context:
space:
mode:
authorrathnor <rathnor>2004-09-12 14:56:20 (GMT)
committerrathnor <rathnor>2004-09-12 14:56:20 (GMT)
commit42c1fd3ae3dd058e146b7350c65b74386123c25c (patch)
treecc549c2c7b12c87f8c33198f5b30f00d9dd30bc6 /src/FbWinFrame.cc
parentc39234195a46cece2bdb18dfdde6c91c7a190dc4 (diff)
downloadfluxbox-42c1fd3ae3dd058e146b7350c65b74386123c25c.zip
fluxbox-42c1fd3ae3dd058e146b7350c65b74386123c25c.tar.bz2
preliminary support for composite/compositing manager. Also general work
for consistency with transparency resources
Diffstat (limited to 'src/FbWinFrame.cc')
-rw-r--r--src/FbWinFrame.cc55
1 files changed, 38 insertions, 17 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index d01b5cf..f5916af 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.78 2004/08/11 13:17:56 fluxgen Exp $ 22// $Id: FbWinFrame.cc,v 1.79 2004/09/12 14:56:18 rathnor Exp $
23 23
24#include "FbWinFrame.hh" 24#include "FbWinFrame.hh"
25 25
@@ -29,6 +29,7 @@
29#include "FbTk/App.hh" 29#include "FbTk/App.hh"
30#include "FbTk/SimpleCommand.hh" 30#include "FbTk/SimpleCommand.hh"
31#include "FbTk/Compose.hh" 31#include "FbTk/Compose.hh"
32#include "FbTk/Transparent.hh"
32#include "CompareWindow.hh" 33#include "CompareWindow.hh"
33#include "FbWinFrameTheme.hh" 34#include "FbWinFrameTheme.hh"
34 35
@@ -215,7 +216,8 @@ void FbWinFrame::moveResize(int x, int y, unsigned int width, unsigned int heigh
215 } else if (move) { 216 } else if (move) {
216 m_window.move(x, y); 217 m_window.move(x, y);
217 // this stuff will be caught by reconfigure if resized 218 // this stuff will be caught by reconfigure if resized
218 if (theme().alpha() != 255) { 219 unsigned char alpha = (m_focused?theme().focusedAlpha():theme().unfocusedAlpha());
220 if (alpha != 255) {
219 // restart update timer 221 // restart update timer
220 m_update_timer.start(); 222 m_update_timer.start();
221 } 223 }
@@ -240,6 +242,13 @@ void FbWinFrame::setFocus(bool newvalue) {
240 renderButtonActive(*m_current_label); 242 renderButtonActive(*m_current_label);
241 } 243 }
242 244
245 if (theme().focusedAlpha() != theme().unfocusedAlpha() && FbTk::Transparent::haveComposite()) {
246 if (m_focused)
247 m_window.setOpaque(theme().focusedAlpha());
248 else
249 m_window.setOpaque(theme().unfocusedAlpha());
250 }
251
243 renderTitlebar(); 252 renderTitlebar();
244 renderButtons(); // parent relative buttons -> need render after titlebar 253 renderButtons(); // parent relative buttons -> need render after titlebar
245 renderHandles(); 254 renderHandles();
@@ -894,8 +903,9 @@ void FbWinFrame::renderTitlebar() {
894 else 903 else
895 m_titlebar.setBackgroundColor(title_color); 904 m_titlebar.setBackgroundColor(title_color);
896 905
897 m_titlebar.setAlpha(theme().alpha()); 906 unsigned char alpha = (m_focused?theme().focusedAlpha():theme().unfocusedAlpha());
898 m_label.setAlpha(theme().alpha()); 907 m_titlebar.setAlpha(alpha);
908 m_label.setAlpha(alpha);
899 909
900 renderLabelButtons(); 910 renderLabelButtons();
901 redrawTitlebar(); 911 redrawTitlebar();
@@ -953,9 +963,10 @@ void FbWinFrame::renderHandles() {
953 } 963 }
954 } 964 }
955 965
956 m_handle.setAlpha(theme().alpha()); 966 unsigned char alpha = (m_focused?theme().focusedAlpha():theme().unfocusedAlpha());
957 m_grip_left.setAlpha(theme().alpha()); 967 m_handle.setAlpha(alpha);
958 m_grip_right.setAlpha(theme().alpha()); 968 m_grip_left.setAlpha(alpha);
969 m_grip_right.setAlpha(alpha);
959 970
960 m_grip_left.clear(); 971 m_grip_left.clear();
961 m_grip_left.updateTransparent(); 972 m_grip_left.updateTransparent();
@@ -999,12 +1010,19 @@ void FbWinFrame::renderButtons() {
999 1010
1000void FbWinFrame::init() { 1011void FbWinFrame::init() {
1001 1012
1002 // setup update timer 1013 if (FbTk::Transparent::haveComposite()) {
1003 FbTk::RefCount<FbTk::Command> update_transp(new FbTk::SimpleCommand<FbWinFrame>(*this, 1014 if (m_focused)
1004 &FbWinFrame::updateTransparent)); 1015 m_window.setOpaque(theme().focusedAlpha());
1005 m_update_timer.setCommand(update_transp); 1016 else
1006 m_update_timer.setTimeout(10L); 1017 m_window.setOpaque(theme().unfocusedAlpha());
1007 m_update_timer.fireOnce(true); 1018 } else {
1019 // setup update timer
1020 FbTk::RefCount<FbTk::Command> update_transp(new FbTk::SimpleCommand<FbWinFrame>(*this,
1021 &FbWinFrame::updateTransparent));
1022 m_update_timer.setCommand(update_transp);
1023 m_update_timer.setTimeout(10L);
1024 m_update_timer.fireOnce(true);
1025 }
1008 1026
1009 if (theme().handleWidth() == 0) 1027 if (theme().handleWidth() == 0)
1010 m_use_handle = false; 1028 m_use_handle = false;
@@ -1052,6 +1070,7 @@ void FbWinFrame::setupButton(FbTk::Button &btn) {
1052 btn.setBackgroundPixmap(m_button_pm); 1070 btn.setBackgroundPixmap(m_button_pm);
1053 else 1071 else
1054 btn.setBackgroundColor(m_button_color); 1072 btn.setBackgroundColor(m_button_color);
1073 btn.setAlpha(theme().focusedAlpha());
1055 } else { // unfocused 1074 } else { // unfocused
1056 btn.setGC(m_theme.buttonPicUnfocusGC()); 1075 btn.setGC(m_theme.buttonPicUnfocusGC());
1057 if (m_button_unfocused_pm) 1076 if (m_button_unfocused_pm)
@@ -1059,9 +1078,9 @@ void FbWinFrame::setupButton(FbTk::Button &btn) {
1059 else 1078 else
1060 btn.setBackgroundColor(m_button_unfocused_color); 1079 btn.setBackgroundColor(m_button_unfocused_color);
1061 1080
1081 btn.setAlpha(theme().unfocusedAlpha());
1062 } 1082 }
1063 1083
1064 btn.setAlpha(theme().alpha());
1065} 1084}
1066 1085
1067void FbWinFrame::render(const FbTk::Texture &tex, FbTk::Color &col, Pixmap &pm, 1086void FbWinFrame::render(const FbTk::Texture &tex, FbTk::Color &col, Pixmap &pm,
@@ -1182,7 +1201,7 @@ void FbWinFrame::renderButtonFocus(FbTk::TextButton &button) {
1182 button.setGC(theme().labelTextFocusGC()); 1201 button.setGC(theme().labelTextFocusGC());
1183 button.setJustify(theme().justify()); 1202 button.setJustify(theme().justify());
1184 button.setBorderWidth(1); 1203 button.setBorderWidth(1);
1185 button.setAlpha(theme().alpha()); 1204 button.setAlpha(theme().focusedAlpha());
1186 1205
1187 if (m_label_focused_pm != 0) { 1206 if (m_label_focused_pm != 0) {
1188 // already set 1207 // already set
@@ -1198,7 +1217,7 @@ void FbWinFrame::renderButtonActive(FbTk::TextButton &button) {
1198 button.setGC(theme().labelTextActiveGC()); 1217 button.setGC(theme().labelTextActiveGC());
1199 button.setJustify(theme().justify()); 1218 button.setJustify(theme().justify());
1200 button.setBorderWidth(1); 1219 button.setBorderWidth(1);
1201 button.setAlpha(theme().alpha()); 1220 button.setAlpha(theme().focusedAlpha());
1202 1221
1203 if (m_label_active_pm != 0) { 1222 if (m_label_active_pm != 0) {
1204 // already set 1223 // already set
@@ -1214,7 +1233,7 @@ void FbWinFrame::renderButtonUnfocus(FbTk::TextButton &button) {
1214 button.setGC(theme().labelTextUnfocusGC()); 1233 button.setGC(theme().labelTextUnfocusGC());
1215 button.setJustify(theme().justify()); 1234 button.setJustify(theme().justify());
1216 button.setBorderWidth(1); 1235 button.setBorderWidth(1);
1217 button.setAlpha(theme().alpha()); 1236 button.setAlpha(theme().unfocusedAlpha());
1218 1237
1219 if (m_label_unfocused_pm != 0) { 1238 if (m_label_unfocused_pm != 0) {
1220 // already set 1239 // already set
@@ -1246,6 +1265,8 @@ private:
1246} 1265}
1247 1266
1248void FbWinFrame::updateTransparent() { 1267void FbWinFrame::updateTransparent() {
1268 if (FbTk::Transparent::haveComposite())
1269 return;
1249 1270
1250 m_label.clear(); 1271 m_label.clear();
1251 m_label.updateTransparent(); 1272 m_label.updateTransparent();