diff options
Diffstat (limited to 'src/FbTk/Container.cc')
-rw-r--r-- | src/FbTk/Container.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/FbTk/Container.cc b/src/FbTk/Container.cc index 381f13f..3374266 100644 --- a/src/FbTk/Container.cc +++ b/src/FbTk/Container.cc | |||
@@ -319,7 +319,7 @@ void Container::repositionItems() { | |||
319 | // if we have a max total size, then we must also resize ourself | 319 | // if we have a max total size, then we must also resize ourself |
320 | // within that bound | 320 | // within that bound |
321 | Alignment align = alignment(); | 321 | Alignment align = alignment(); |
322 | if (m_max_total_size && (align == RIGHT || align == LEFT)) { | 322 | if (m_max_total_size && align != RELATIVE) { |
323 | total_width = (max_width_per_client + borderW) * num_items - borderW; | 323 | total_width = (max_width_per_client + borderW) * num_items - borderW; |
324 | if (total_width > m_max_total_size) { | 324 | if (total_width > m_max_total_size) { |
325 | total_width = m_max_total_size; | 325 | total_width = m_max_total_size; |
@@ -332,14 +332,21 @@ void Container::repositionItems() { | |||
332 | // calling Container::resize here risks infinite loops | 332 | // calling Container::resize here risks infinite loops |
333 | unsigned int neww = total_width, newh = height; | 333 | unsigned int neww = total_width, newh = height; |
334 | translateSize(m_orientation, neww, newh); | 334 | translateSize(m_orientation, neww, newh); |
335 | if ((align == RIGHT && m_orientation != ROT270) || | 335 | if (!(align == LEFT && (m_orientation == ROT0 || |
336 | (align == LEFT && m_orientation == ROT270)) { | 336 | m_orientation == ROT90)) && |
337 | !(align == RIGHT && (m_orientation == ROT180 || | ||
338 | m_orientation == ROT270))) { | ||
337 | int deltax = 0; | 339 | int deltax = 0; |
338 | int deltay = 0; | 340 | int deltay = 0; |
339 | if (m_orientation == ROT0 || m_orientation == ROT180) | 341 | if (m_orientation == ROT0 || m_orientation == ROT180) |
340 | deltax = - (total_width - cur_width); | 342 | deltax = - (total_width - cur_width); |
341 | else | 343 | else |
342 | deltay = - (total_width - cur_width); | 344 | deltay = - (total_width - cur_width); |
345 | // TODO: rounding errors could accumulate in this process | ||
346 | if (align == CENTER) { | ||
347 | deltax = deltax/2; | ||
348 | deltay = deltay/2; | ||
349 | } | ||
343 | 350 | ||
344 | FbWindow::moveResize(x() + deltax, y() + deltay, neww, newh); | 351 | FbWindow::moveResize(x() + deltax, y() + deltay, neww, newh); |
345 | } else { | 352 | } else { |
@@ -405,6 +412,7 @@ void Container::repositionItems() { | |||
405 | unsigned int Container::maxWidthPerClient() const { | 412 | unsigned int Container::maxWidthPerClient() const { |
406 | switch (alignment()) { | 413 | switch (alignment()) { |
407 | case RIGHT: | 414 | case RIGHT: |
415 | case CENTER: | ||
408 | case LEFT: | 416 | case LEFT: |
409 | return m_max_size_per_client; | 417 | return m_max_size_per_client; |
410 | break; | 418 | break; |