diff options
author | Mark Tiefenbruck <mark@fluxbox.org> | 2008-08-15 11:16:30 (GMT) |
---|---|---|
committer | Mark Tiefenbruck <mark@fluxbox.org> | 2008-08-15 11:16:30 (GMT) |
commit | 1dab657708cd8246c2ce5a6aaa05cc5733e09c54 (patch) | |
tree | bd5a647d38f847dce1902536441a3c8ad6222881 /src/WinClient.cc | |
parent | 6053ecc1b573e437dd0d1752670748c5c3679669 (diff) | |
download | fluxbox-1dab657708cd8246c2ce5a6aaa05cc5733e09c54.zip fluxbox-1dab657708cd8246c2ce5a6aaa05cc5733e09c54.tar.bz2 |
aspect ratios should take base size into account, fix size hint initialization
Diffstat (limited to 'src/WinClient.cc')
-rw-r--r-- | src/WinClient.cc | 120 |
1 files changed, 52 insertions, 68 deletions
diff --git a/src/WinClient.cc b/src/WinClient.cc index f421013..2c9cdc6 100644 --- a/src/WinClient.cc +++ b/src/WinClient.cc | |||
@@ -82,14 +82,6 @@ WinClient::WinClient(Window win, BScreen &screen, FluxboxWindow *fbwin): | |||
82 | m_mwm_hint(0), | 82 | m_mwm_hint(0), |
83 | m_strut(0) { | 83 | m_strut(0) { |
84 | 84 | ||
85 | m_size_hints.min_width = m_size_hints.min_height = | ||
86 | m_size_hints.width_inc = m_size_hints.height_inc = | ||
87 | m_size_hints.base_width = m_size_hints.base_height = 1; | ||
88 | |||
89 | m_size_hints.max_width = m_size_hints.max_height = | ||
90 | m_size_hints.min_aspect_x = m_size_hints.min_aspect_y = | ||
91 | m_size_hints.max_aspect_x = m_size_hints.max_aspect_y = 0; | ||
92 | |||
93 | updateWMProtocols(); | 85 | updateWMProtocols(); |
94 | updateMWMHints(); | 86 | updateMWMHints(); |
95 | updateWMHints(); | 87 | updateWMHints(); |
@@ -471,73 +463,65 @@ void WinClient::updateWMHints() { | |||
471 | void WinClient::updateWMNormalHints() { | 463 | void WinClient::updateWMNormalHints() { |
472 | long icccm_mask; | 464 | long icccm_mask; |
473 | XSizeHints sizehint; | 465 | XSizeHints sizehint; |
474 | if (! XGetWMNormalHints(display(), window(), &sizehint, &icccm_mask)) { | 466 | if (!XGetWMNormalHints(display(), window(), &sizehint, &icccm_mask)) |
475 | m_size_hints.min_width = m_size_hints.min_height = | 467 | sizehint.flags = 0; |
476 | m_size_hints.base_width = m_size_hints.base_height = | 468 | |
477 | m_size_hints.width_inc = m_size_hints.height_inc = 1; | 469 | normal_hint_flags = sizehint.flags; |
470 | |||
471 | if (sizehint.flags & PMinSize) { | ||
472 | m_size_hints.min_width = sizehint.min_width; | ||
473 | m_size_hints.min_height = sizehint.min_height; | ||
474 | } else | ||
475 | m_size_hints.min_width = m_size_hints.min_height = 1; | ||
476 | |||
477 | if (sizehint.flags & PBaseSize) { | ||
478 | m_size_hints.base_width = sizehint.base_width; | ||
479 | m_size_hints.base_height = sizehint.base_height; | ||
480 | if (!(sizehint.flags & PMinSize)) { | ||
481 | m_size_hints.min_width = m_size_hints.base_width; | ||
482 | m_size_hints.min_height = m_size_hints.base_height; | ||
483 | } | ||
484 | } else | ||
485 | m_size_hints.base_width = m_size_hints.base_height = 0; | ||
486 | |||
487 | if (sizehint.flags & PMaxSize) { | ||
488 | m_size_hints.max_width = sizehint.max_width; | ||
489 | m_size_hints.max_height = sizehint.max_height; | ||
490 | } else { | ||
478 | m_size_hints.max_width = 0; // unbounded | 491 | m_size_hints.max_width = 0; // unbounded |
479 | m_size_hints.max_height = 0; | 492 | m_size_hints.max_height = 0; |
493 | } | ||
494 | |||
495 | if (sizehint.flags & PResizeInc) { | ||
496 | m_size_hints.width_inc = sizehint.width_inc; | ||
497 | m_size_hints.height_inc = sizehint.height_inc; | ||
498 | } else | ||
499 | m_size_hints.width_inc = m_size_hints.height_inc = 1; | ||
500 | |||
501 | if (sizehint.flags & PAspect) { | ||
502 | m_size_hints.min_aspect_x = sizehint.min_aspect.x; | ||
503 | m_size_hints.min_aspect_y = sizehint.min_aspect.y; | ||
504 | m_size_hints.max_aspect_x = sizehint.max_aspect.x; | ||
505 | m_size_hints.max_aspect_y = sizehint.max_aspect.y; | ||
506 | } else | ||
480 | m_size_hints.min_aspect_x = m_size_hints.min_aspect_y = | 507 | m_size_hints.min_aspect_x = m_size_hints.min_aspect_y = |
481 | m_size_hints.max_aspect_x = m_size_hints.max_aspect_y = 0; | 508 | m_size_hints.max_aspect_x = m_size_hints.max_aspect_y = 0; |
482 | m_win_gravity = NorthWestGravity; | ||
483 | } else { | ||
484 | normal_hint_flags = sizehint.flags; | ||
485 | |||
486 | if (sizehint.flags & PMinSize) { | ||
487 | m_size_hints.min_width = sizehint.min_width; | ||
488 | m_size_hints.min_height = sizehint.min_height; | ||
489 | if (!(sizehint.flags & PBaseSize)) { | ||
490 | m_size_hints.base_width = m_size_hints.min_width; | ||
491 | m_size_hints.base_height = m_size_hints.min_height; | ||
492 | } | ||
493 | } else { | ||
494 | m_size_hints.min_width = m_size_hints.min_height = 1; | ||
495 | m_size_hints.base_width = m_size_hints.base_height = 0; | ||
496 | } | ||
497 | |||
498 | if (sizehint.flags & PBaseSize) { | ||
499 | m_size_hints.base_width = sizehint.base_width; | ||
500 | m_size_hints.base_height = sizehint.base_height; | ||
501 | if (!(sizehint.flags & PMinSize)) { | ||
502 | m_size_hints.min_width = m_size_hints.base_width; | ||
503 | m_size_hints.min_height = m_size_hints.base_height; | ||
504 | } | ||
505 | } // default set in PMinSize | ||
506 | |||
507 | if (sizehint.flags & PMaxSize) { | ||
508 | m_size_hints.max_width = sizehint.max_width; | ||
509 | m_size_hints.max_height = sizehint.max_height; | ||
510 | } else { | ||
511 | m_size_hints.max_width = 0; // unbounded | ||
512 | m_size_hints.max_height = 0; | ||
513 | } | ||
514 | 509 | ||
515 | if (sizehint.flags & PResizeInc) { | 510 | if (sizehint.flags & PWinGravity) |
516 | m_size_hints.width_inc = sizehint.width_inc; | 511 | m_win_gravity = sizehint.win_gravity; |
517 | m_size_hints.height_inc = sizehint.height_inc; | 512 | else |
518 | } else | 513 | m_win_gravity = NorthWestGravity; |
519 | m_size_hints.width_inc = m_size_hints.height_inc = 1; | ||
520 | |||
521 | if (m_size_hints.width_inc == 0) | ||
522 | m_size_hints.width_inc = 1; | ||
523 | if (m_size_hints.height_inc == 0) | ||
524 | m_size_hints.height_inc = 1; | ||
525 | |||
526 | if (sizehint.flags & PAspect) { | ||
527 | m_size_hints.min_aspect_x = sizehint.min_aspect.x; | ||
528 | m_size_hints.min_aspect_y = sizehint.min_aspect.y; | ||
529 | m_size_hints.max_aspect_x = sizehint.max_aspect.x; | ||
530 | m_size_hints.max_aspect_y = sizehint.max_aspect.y; | ||
531 | } else | ||
532 | m_size_hints.min_aspect_x = m_size_hints.min_aspect_y = | ||
533 | m_size_hints.max_aspect_x = m_size_hints.max_aspect_y = 0; | ||
534 | 514 | ||
535 | if (sizehint.flags & PWinGravity) | 515 | // some sanity checks |
536 | m_win_gravity = sizehint.win_gravity; | 516 | if (m_size_hints.width_inc == 0) |
537 | else | 517 | m_size_hints.width_inc = 1; |
538 | m_win_gravity = NorthWestGravity; | 518 | if (m_size_hints.height_inc == 0) |
519 | m_size_hints.height_inc = 1; | ||
539 | 520 | ||
540 | } | 521 | if (m_size_hints.base_width > m_size_hints.min_width) |
522 | m_size_hints.min_width = m_size_hints.base_width; | ||
523 | if (m_size_hints.base_height > m_size_hints.min_height) | ||
524 | m_size_hints.min_height = m_size_hints.base_height; | ||
541 | } | 525 | } |
542 | 526 | ||
543 | Window WinClient::getGroupLeftWindow() const { | 527 | Window WinClient::getGroupLeftWindow() const { |