all repos — fluxbox @ 9859cc53d0489494536221c3b95078dddc583e61

custom fork of the fluxbox windowmanager

more gravity tweaks
rathnor rathnor
commit

9859cc53d0489494536221c3b95078dddc583e61

parent

2746ab43aa20f53052ffb100d19119dc5388f260

3 files changed, 33 insertions(+), 10 deletions(-)

jump to
M ChangeLogChangeLog

@@ -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.
M src/FbWinFrame.ccsrc/FbWinFrame.cc

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// 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 @@

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 @@ case SouthEastGravity:

// 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; }
M src/Window.ccsrc/Window.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// 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 @@ // commit current decoration values to actual displayed things

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();

@@ -2616,6 +2620,13 @@ if (decorations.handle) {

frame().showHandle(); } 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(); }