diff options
author | rathnor <rathnor> | 2003-09-11 19:55:27 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2003-09-11 19:55:27 (GMT) |
commit | 6d6425cbde2a4c2038f513c78e5953d0dbdbc20d (patch) | |
tree | 19edf876933796c277816f568f1754c562eb3f43 /src/FbWinFrame.cc | |
parent | 16653d23d5d7a0dd017cce6484e8865f59edb9c6 (diff) | |
download | fluxbox_pavel-6d6425cbde2a4c2038f513c78e5953d0dbdbc20d.zip fluxbox_pavel-6d6425cbde2a4c2038f513c78e5953d0dbdbc20d.tar.bz2 |
fix gravity handling
Diffstat (limited to 'src/FbWinFrame.cc')
-rw-r--r-- | src/FbWinFrame.cc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index 3dd0f1b..31dfae0 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.47 2003/09/11 13:35:37 rathnor Exp $ | 22 | // $Id: FbWinFrame.cc,v 1.48 2003/09/11 19:55:27 rathnor Exp $ |
23 | 23 | ||
24 | #include "FbWinFrame.hh" | 24 | #include "FbWinFrame.hh" |
25 | 25 | ||
@@ -1112,6 +1112,7 @@ void FbWinFrame::updateTransparent() { | |||
1112 | 1112 | ||
1113 | // this function translates its arguments according to win_gravity | 1113 | // this function translates its arguments according to win_gravity |
1114 | // if win_gravity is negative, it does an inverse translation | 1114 | // if win_gravity is negative, it does an inverse translation |
1115 | // This function should be used when a window is mapped/unmapped/pos configured | ||
1115 | void FbWinFrame::gravityTranslate(int &x, int &y, int win_gravity, bool move_frame) { | 1116 | void FbWinFrame::gravityTranslate(int &x, int &y, int win_gravity, bool move_frame) { |
1116 | bool invert = false; | 1117 | bool invert = false; |
1117 | if (win_gravity < 0) { | 1118 | if (win_gravity < 0) { |
@@ -1140,7 +1141,9 @@ void FbWinFrame::gravityTranslate(int &x, int &y, int win_gravity, bool move_fra | |||
1140 | int x_offset = 0; | 1141 | int x_offset = 0; |
1141 | int y_offset = 0; | 1142 | int y_offset = 0; |
1142 | 1143 | ||
1143 | // Start with X offset | 1144 | // no X offset, since we don't have extra frame on the sides |
1145 | |||
1146 | // then y offset | ||
1144 | switch (win_gravity) { | 1147 | switch (win_gravity) { |
1145 | case NorthWestGravity: | 1148 | case NorthWestGravity: |
1146 | case NorthGravity: | 1149 | case NorthGravity: |
@@ -1153,23 +1156,21 @@ void FbWinFrame::gravityTranslate(int &x, int &y, int win_gravity, bool move_fra | |||
1153 | // window shifted down by height of titlebar, and the handle | 1156 | // window shifted down by height of titlebar, and the handle |
1154 | // since that's necessary to get the bottom of the frame | 1157 | // since that's necessary to get the bottom of the frame |
1155 | // all the way up | 1158 | // all the way up |
1156 | x_offset = -(m_titlebar.height() + m_titlebar.borderWidth() | 1159 | y_offset = -(m_titlebar.height() + m_titlebar.borderWidth() |
1157 | + m_handle.height() + m_handle.borderWidth()); | 1160 | + m_handle.height() + m_handle.borderWidth()); |
1158 | break; | 1161 | break; |
1159 | case WestGravity: | 1162 | case WestGravity: |
1160 | case EastGravity: | 1163 | case EastGravity: |
1161 | case CenterGravity: | 1164 | case CenterGravity: |
1162 | // these centered ones are a little more interesting | 1165 | // these centered ones are a little more interesting |
1163 | x_offset = -(m_titlebar.height() + m_titlebar.borderWidth() | 1166 | y_offset = -(m_titlebar.height() + m_titlebar.borderWidth() |
1164 | + m_handle.height() + m_handle.borderWidth()) / 2; | 1167 | + m_handle.height() + m_handle.borderWidth()) / 2; |
1165 | break; | 1168 | break; |
1166 | case StaticGravity: | 1169 | case StaticGravity: |
1167 | x_offset = -(m_titlebar.height() + m_titlebar.borderWidth()); | 1170 | y_offset = -(m_titlebar.height() + m_titlebar.borderWidth()); |
1168 | break; | 1171 | break; |
1169 | } | 1172 | } |
1170 | 1173 | ||
1171 | // no Y offset, since we don't have a frame down there | ||
1172 | |||
1173 | if (invert) { | 1174 | if (invert) { |
1174 | x_offset = -x_offset; | 1175 | x_offset = -x_offset; |
1175 | y_offset = -y_offset; | 1176 | y_offset = -y_offset; |
@@ -1179,6 +1180,6 @@ void FbWinFrame::gravityTranslate(int &x, int &y, int win_gravity, bool move_fra | |||
1179 | y += y_offset; | 1180 | y += y_offset; |
1180 | 1181 | ||
1181 | if (move_frame && (x_offset != 0 || y_offset != 0)) { | 1182 | if (move_frame && (x_offset != 0 || y_offset != 0)) { |
1182 | move(m_window.x() + x_offset, m_window.y() + y_offset); | 1183 | move(x,y); |
1183 | } | 1184 | } |
1184 | } | 1185 | } |