From 9859cc53d0489494536221c3b95078dddc583e61 Mon Sep 17 00:00:00 2001 From: rathnor Date: Tue, 16 Sep 2003 13:11:42 +0000 Subject: more gravity tweaks --- ChangeLog | 4 ++++ src/FbWinFrame.cc | 26 +++++++++++++++++--------- src/Window.cc | 13 ++++++++++++- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1370c25..8a66594 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ (Format: Year/Month/Day) Changes for 0.9.6: +*03/09/16: + * Apply gravity when changing decorations (Simon) + - also fix gravity when decorations not present + Window.cc FbWinFrame.cc *03/09/14: * Focus fixes (Simon) Hopefully fixes mysterious instances of focus not being set right. diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index 9da992c..1781fcd 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbWinFrame.cc,v 1.52 2003/09/15 20:14:49 fluxgen Exp $ +// $Id: FbWinFrame.cc,v 1.53 2003/09/16 13:11:41 rathnor Exp $ #include "FbWinFrame.hh" @@ -1165,9 +1165,7 @@ void FbWinFrame::gravityTranslate(int &x, int &y, int win_gravity, bool move_fra int x_offset = 0; int y_offset = 0; - // no X offset, since we don't have extra frame on the sides - - // then y offset + // mostly no X offset, since we don't have extra frame on the sides switch (win_gravity) { case NorthWestGravity: case NorthGravity: @@ -1180,18 +1178,28 @@ void FbWinFrame::gravityTranslate(int &x, int &y, int win_gravity, bool move_fra // window shifted down by height of titlebar, and the handle // since that's necessary to get the bottom of the frame // all the way up - y_offset = -(m_titlebar.height() + m_titlebar.borderWidth() - + m_handle.height() + m_handle.borderWidth()); + if (m_use_titlebar) + y_offset -= m_titlebar.height() + m_titlebar.borderWidth(); + if (m_use_handle) + y_offset -= m_handle.height() + m_handle.borderWidth(); break; case WestGravity: case EastGravity: case CenterGravity: // these centered ones are a little more interesting - y_offset = -(m_titlebar.height() + m_titlebar.borderWidth() - + m_handle.height() + m_handle.borderWidth()) / 2; + if (m_use_titlebar) + y_offset -= m_titlebar.height() + m_titlebar.borderWidth(); + if (m_use_handle) + y_offset -= m_handle.height() + m_handle.borderWidth(); + y_offset /= 2; break; case StaticGravity: - y_offset = -(m_titlebar.height() + m_titlebar.borderWidth()); + if (m_use_titlebar) + y_offset -= m_titlebar.height() + m_titlebar.borderWidth(); + // static is the only one that also has the + // border taken into account + x_offset -= m_window.borderWidth(); + y_offset -= m_window.borderWidth(); break; } diff --git a/src/Window.cc b/src/Window.cc index 0ab1f00..38fe3f5 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.cc,v 1.230 2003/09/15 20:27:06 fluxgen Exp $ +// $Id: Window.cc,v 1.231 2003/09/16 13:11:42 rathnor Exp $ #include "Window.hh" @@ -2599,6 +2599,10 @@ void FluxboxWindow::setDecoration(Decoration decoration) { void FluxboxWindow::applyDecorations(bool initial) { frame().clientArea().setBorderWidth(0); // client area bordered by other things + int grav_x=0, grav_y=0; + // negate gravity + frame().gravityTranslate(grav_x, grav_y, -m_client->gravity(), false); + unsigned int border_width = 0; if (decorations.border) border_width = frame().theme().border().width(); @@ -2617,6 +2621,13 @@ void FluxboxWindow::applyDecorations(bool initial) { } else frame().hideHandle(); + // apply gravity once more + frame().gravityTranslate(grav_x, grav_y, m_client->gravity(), false); + + // if the location changes, shift it + if (grav_x != 0 || grav_y != 0) + frame().move(grav_x + frame().x(), grav_y + frame().y()); + frame().reconfigure(); } -- cgit v0.11.2