more gravity tweaks

This commit is contained in:
rathnor 2003-09-16 13:11:42 +00:00
parent 2746ab43aa
commit 9859cc53d0
3 changed files with 33 additions and 10 deletions

View file

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

View file

@ -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;
}

View file

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