diff options
author | rathnor <rathnor> | 2003-09-16 13:11:42 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2003-09-16 13:11:42 (GMT) |
commit | 9859cc53d0489494536221c3b95078dddc583e61 (patch) | |
tree | c0bb9fb08231f5f5e63937ac233c526c2fb61fdd /src | |
parent | 2746ab43aa20f53052ffb100d19119dc5388f260 (diff) | |
download | fluxbox-9859cc53d0489494536221c3b95078dddc583e61.zip fluxbox-9859cc53d0489494536221c3b95078dddc583e61.tar.bz2 |
more gravity tweaks
Diffstat (limited to 'src')
-rw-r--r-- | src/FbWinFrame.cc | 26 | ||||
-rw-r--r-- | src/Window.cc | 13 |
2 files changed, 29 insertions, 10 deletions
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 @@ | |||
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.52 2003/09/15 20:14:49 fluxgen Exp $ | 22 | // $Id: FbWinFrame.cc,v 1.53 2003/09/16 13:11:41 rathnor Exp $ |
23 | 23 | ||
24 | #include "FbWinFrame.hh" | 24 | #include "FbWinFrame.hh" |
25 | 25 | ||
@@ -1165,9 +1165,7 @@ void FbWinFrame::gravityTranslate(int &x, int &y, int win_gravity, bool move_fra | |||
1165 | int x_offset = 0; | 1165 | int x_offset = 0; |
1166 | int y_offset = 0; | 1166 | int y_offset = 0; |
1167 | 1167 | ||
1168 | // no X offset, since we don't have extra frame on the sides | 1168 | // mostly no X offset, since we don't have extra frame on the sides |
1169 | |||
1170 | // then y offset | ||
1171 | switch (win_gravity) { | 1169 | switch (win_gravity) { |
1172 | case NorthWestGravity: | 1170 | case NorthWestGravity: |
1173 | case NorthGravity: | 1171 | case NorthGravity: |
@@ -1180,18 +1178,28 @@ void FbWinFrame::gravityTranslate(int &x, int &y, int win_gravity, bool move_fra | |||
1180 | // window shifted down by height of titlebar, and the handle | 1178 | // window shifted down by height of titlebar, and the handle |
1181 | // since that's necessary to get the bottom of the frame | 1179 | // since that's necessary to get the bottom of the frame |
1182 | // all the way up | 1180 | // all the way up |
1183 | y_offset = -(m_titlebar.height() + m_titlebar.borderWidth() | 1181 | if (m_use_titlebar) |
1184 | + m_handle.height() + m_handle.borderWidth()); | 1182 | y_offset -= m_titlebar.height() + m_titlebar.borderWidth(); |
1183 | if (m_use_handle) | ||
1184 | y_offset -= m_handle.height() + m_handle.borderWidth(); | ||
1185 | break; | 1185 | break; |
1186 | case WestGravity: | 1186 | case WestGravity: |
1187 | case EastGravity: | 1187 | case EastGravity: |
1188 | case CenterGravity: | 1188 | case CenterGravity: |
1189 | // these centered ones are a little more interesting | 1189 | // these centered ones are a little more interesting |
1190 | y_offset = -(m_titlebar.height() + m_titlebar.borderWidth() | 1190 | if (m_use_titlebar) |
1191 | + m_handle.height() + m_handle.borderWidth()) / 2; | 1191 | y_offset -= m_titlebar.height() + m_titlebar.borderWidth(); |
1192 | if (m_use_handle) | ||
1193 | y_offset -= m_handle.height() + m_handle.borderWidth(); | ||
1194 | y_offset /= 2; | ||
1192 | break; | 1195 | break; |
1193 | case StaticGravity: | 1196 | case StaticGravity: |
1194 | y_offset = -(m_titlebar.height() + m_titlebar.borderWidth()); | 1197 | if (m_use_titlebar) |
1198 | y_offset -= m_titlebar.height() + m_titlebar.borderWidth(); | ||
1199 | // static is the only one that also has the | ||
1200 | // border taken into account | ||
1201 | x_offset -= m_window.borderWidth(); | ||
1202 | y_offset -= m_window.borderWidth(); | ||
1195 | break; | 1203 | break; |
1196 | } | 1204 | } |
1197 | 1205 | ||
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 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Window.cc,v 1.230 2003/09/15 20:27:06 fluxgen Exp $ | 25 | // $Id: Window.cc,v 1.231 2003/09/16 13:11:42 rathnor Exp $ |
26 | 26 | ||
27 | #include "Window.hh" | 27 | #include "Window.hh" |
28 | 28 | ||
@@ -2599,6 +2599,10 @@ void FluxboxWindow::setDecoration(Decoration decoration) { | |||
2599 | void FluxboxWindow::applyDecorations(bool initial) { | 2599 | void FluxboxWindow::applyDecorations(bool initial) { |
2600 | frame().clientArea().setBorderWidth(0); // client area bordered by other things | 2600 | frame().clientArea().setBorderWidth(0); // client area bordered by other things |
2601 | 2601 | ||
2602 | int grav_x=0, grav_y=0; | ||
2603 | // negate gravity | ||
2604 | frame().gravityTranslate(grav_x, grav_y, -m_client->gravity(), false); | ||
2605 | |||
2602 | unsigned int border_width = 0; | 2606 | unsigned int border_width = 0; |
2603 | if (decorations.border) | 2607 | if (decorations.border) |
2604 | border_width = frame().theme().border().width(); | 2608 | border_width = frame().theme().border().width(); |
@@ -2617,6 +2621,13 @@ void FluxboxWindow::applyDecorations(bool initial) { | |||
2617 | } else | 2621 | } else |
2618 | frame().hideHandle(); | 2622 | frame().hideHandle(); |
2619 | 2623 | ||
2624 | // apply gravity once more | ||
2625 | frame().gravityTranslate(grav_x, grav_y, m_client->gravity(), false); | ||
2626 | |||
2627 | // if the location changes, shift it | ||
2628 | if (grav_x != 0 || grav_y != 0) | ||
2629 | frame().move(grav_x + frame().x(), grav_y + frame().y()); | ||
2630 | |||
2620 | frame().reconfigure(); | 2631 | frame().reconfigure(); |
2621 | } | 2632 | } |
2622 | 2633 | ||