aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2008-05-24 08:03:59 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2008-05-24 08:03:59 (GMT)
commit46bca62a9cd8052bd8749da8b1aa7539d5fe8c23 (patch)
treeb9002d13a8fc9ecf3e3106b9ba967fd00a5bdc25 /src/Window.cc
parent5ecb192a9cbebcc041cc1330383e4ca466349670 (diff)
downloadfluxbox-46bca62a9cd8052bd8749da8b1aa7539d5fe8c23.zip
fluxbox-46bca62a9cd8052bd8749da8b1aa7539d5fe8c23.tar.bz2
move FluxboxWindow::applyDecorations() to FbWinFrame
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc73
1 files changed, 8 insertions, 65 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 8ad1762..29acd3b 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -303,6 +303,7 @@ FluxboxWindow::FluxboxWindow(WinClient &client, FbTk::XLayer &layer):
303 m_resize_corner(RIGHTBOTTOM) { 303 m_resize_corner(RIGHTBOTTOM) {
304 304
305 m_theme.reconfigSig().attach(this); 305 m_theme.reconfigSig().attach(this);
306 m_frame.frameExtentSig().attach(this);
306 307
307 init(); 308 init();
308 309
@@ -501,7 +502,7 @@ void FluxboxWindow::init() {
501 setOnHead(screen().getCurrHead()); 502 setOnHead(screen().getCurrHead());
502 503
503 // we must do this now, or else resizing may not work properly 504 // we must do this now, or else resizing may not work properly
504 applyDecorations(true); 505 applyDecorations();
505 506
506 Fluxbox::instance()->attachSignals(*this); 507 Fluxbox::instance()->attachSignals(*this);
507 508
@@ -601,7 +602,7 @@ void FluxboxWindow::init() {
601 gettimeofday(&now, NULL); 602 gettimeofday(&now, NULL);
602 m_creation_time = now.tv_sec; 603 m_creation_time = now.tv_sec;
603 604
604 sendConfigureNotify(); 605 frame().frameExtentSig().notify();
605 606
606 setupWindow(); 607 setupWindow();
607 608
@@ -3015,74 +3016,16 @@ void FluxboxWindow::update(FbTk::Subject *subj) {
3015 } else if (subj == &m_theme.reconfigSig()) { 3016 } else if (subj == &m_theme.reconfigSig()) {
3016 frame().reconfigure(); 3017 frame().reconfigure();
3017 reconfigTheme(); 3018 reconfigTheme();
3019 } else if (m_initialized && subj == &m_frame.frameExtentSig()) {
3020 Fluxbox::instance()->updateFrameExtents(*this);
3021 sendConfigureNotify();
3018 } 3022 }
3019} 3023}
3020 3024
3021// commit current decoration values to actual displayed things 3025// commit current decoration values to actual displayed things
3022void FluxboxWindow::applyDecorations(bool initial) { 3026void FluxboxWindow::applyDecorations() {
3023 frame().clientArea().setBorderWidth(0); // client area bordered by other things
3024
3025 unsigned int border_width = 0;
3026 if (decorations.border)
3027 border_width = frame().theme()->border().width();
3028
3029 bool client_move = false;
3030
3031 // borderWidth setting handles its own gravity
3032 if (initial || frame().window().borderWidth() != border_width) {
3033 client_move = true;
3034 frame().setBorderWidth(border_width);
3035 }
3036
3037 int grav_x=0, grav_y=0;
3038 // negate gravity
3039 frame().gravityTranslate(grav_x, grav_y, -m_client->gravity(), m_client->old_bw, false);
3040
3041 // tab deocration only affects if we're external
3042 // must do before the setTabMode in case it goes
3043 // to external and is meant to be hidden
3044 if (decorations.tab)
3045 client_move |= frame().showTabs();
3046 else
3047 client_move |= frame().hideTabs();
3048
3049 // we rely on frame not doing anything if it is already shown/hidden
3050 if (decorations.titlebar) {
3051 bool change = frame().showTitlebar();
3052 client_move |= change;
3053 if (screen().getDefaultInternalTabs()) {
3054 client_move |= frame().setTabMode(FbWinFrame::INTERNAL);
3055 } else {
3056 client_move |= frame().setTabMode(FbWinFrame::EXTERNAL);
3057 }
3058 } else {
3059 client_move |= frame().hideTitlebar();
3060 if (decorations.tab)
3061 client_move |= frame().setTabMode(FbWinFrame::EXTERNAL);
3062 }
3063
3064 if (decorations.handle) {
3065 client_move |= frame().showHandle();
3066 } else
3067 client_move |= frame().hideHandle();
3068
3069 // apply gravity once more
3070 frame().gravityTranslate(grav_x, grav_y, m_client->gravity(), m_client->old_bw, false);
3071
3072 // if the location changes, shift it
3073 if (grav_x != 0 || grav_y != 0) {
3074 move(grav_x + frame().x(), grav_y + frame().y());
3075 client_move = true;
3076 }
3077
3078 frame().setDecorationMask(decorationMask()); 3027 frame().setDecorationMask(decorationMask());
3079 frame().reconfigure(); 3028 frame().applyDecorations();
3080 if (client_move)
3081 Fluxbox::instance()->updateFrameExtents(*this);
3082
3083 if (!initial && client_move)
3084 sendConfigureNotify();
3085
3086} 3029}
3087 3030
3088void FluxboxWindow::toggleDecoration() { 3031void FluxboxWindow::toggleDecoration() {