diff options
author | Mark Tiefenbruck <mark@fluxbox.org> | 2009-07-24 07:56:04 (GMT) |
---|---|---|
committer | Mark Tiefenbruck <mark@fluxbox.org> | 2009-07-24 07:56:04 (GMT) |
commit | 9dcbff31b492ca4277471accc95696e0f9a0dd20 (patch) | |
tree | 36d4d1b107c434f49706b18f4af7aa4485282a2d | |
parent | 589125672b684f18fbfb81dddb3a3fe45c857516 (diff) | |
download | fluxbox_paul-9dcbff31b492ca4277471accc95696e0f9a0dd20.zip fluxbox_paul-9dcbff31b492ca4277471accc95696e0f9a0dd20.tar.bz2 |
make autohide only show the border or 1 pixel if borderless
-rw-r--r-- | src/Slit.cc | 29 | ||||
-rw-r--r-- | src/Toolbar.cc | 33 |
2 files changed, 28 insertions, 34 deletions
diff --git a/src/Slit.cc b/src/Slit.cc index 5bb96c4..10fec24 100644 --- a/src/Slit.cc +++ b/src/Slit.cc | |||
@@ -766,30 +766,27 @@ void Slit::reposition() { | |||
766 | } | 766 | } |
767 | 767 | ||
768 | int border_width = theme()->borderWidth(); | 768 | int border_width = theme()->borderWidth(); |
769 | int bevel_width = theme()->bevelWidth(); | 769 | int pixel = (border_width == 0 ? 1 : 0); |
770 | // make sure at leaste one pixel is visible | ||
771 | if (border_width >= bevel_width) | ||
772 | bevel_width = border_width + 1; | ||
773 | // place the slit in the appropriate place | 770 | // place the slit in the appropriate place |
774 | switch (placement()) { | 771 | switch (placement()) { |
775 | case TOPLEFT: | 772 | case TOPLEFT: |
776 | frame.x = head_x; | 773 | frame.x = head_x; |
777 | frame.y = head_y; | 774 | frame.y = head_y; |
778 | frame.x_hidden = head_x; | 775 | frame.x_hidden = head_x; |
779 | frame.y_hidden = bevel_width - border_width - frame.height; | 776 | frame.y_hidden = head_y + pixel - border_width - frame.height; |
780 | break; | 777 | break; |
781 | 778 | ||
782 | case LEFTTOP: | 779 | case LEFTTOP: |
783 | frame.x = head_x; | 780 | frame.x = head_x; |
784 | frame.y = head_y; | 781 | frame.y = head_y; |
785 | frame.x_hidden = bevel_width - border_width - frame.width; | 782 | frame.x_hidden = head_x + pixel - border_width - frame.width; |
786 | frame.y_hidden = head_y; | 783 | frame.y_hidden = head_y; |
787 | break; | 784 | break; |
788 | 785 | ||
789 | case LEFTCENTER: | 786 | case LEFTCENTER: |
790 | frame.x = head_x; | 787 | frame.x = head_x; |
791 | frame.y = head_y + (head_h - frame.height) / 2; | 788 | frame.y = head_y + (head_h - frame.height) / 2; |
792 | frame.x_hidden = head_x + bevel_width - border_width - frame.width; | 789 | frame.x_hidden = head_x + pixel - border_width - frame.width; |
793 | frame.y_hidden = frame.y; | 790 | frame.y_hidden = frame.y; |
794 | break; | 791 | break; |
795 | 792 | ||
@@ -797,13 +794,13 @@ void Slit::reposition() { | |||
797 | frame.x = head_x; | 794 | frame.x = head_x; |
798 | frame.y = head_y + head_h - frame.height - border_width*2; | 795 | frame.y = head_y + head_h - frame.height - border_width*2; |
799 | frame.x_hidden = head_x; | 796 | frame.x_hidden = head_x; |
800 | frame.y_hidden = head_y + head_h - bevel_width - border_width; | 797 | frame.y_hidden = head_y + head_h - pixel - border_width; |
801 | break; | 798 | break; |
802 | 799 | ||
803 | case LEFTBOTTOM: | 800 | case LEFTBOTTOM: |
804 | frame.x = head_x; | 801 | frame.x = head_x; |
805 | frame.y = head_y + head_h - frame.height - border_width*2; | 802 | frame.y = head_y + head_h - frame.height - border_width*2; |
806 | frame.x_hidden = head_x + bevel_width - border_width - frame.width; | 803 | frame.x_hidden = head_x + pixel - border_width - frame.width; |
807 | frame.y_hidden = frame.y; | 804 | frame.y_hidden = frame.y; |
808 | break; | 805 | break; |
809 | 806 | ||
@@ -811,34 +808,34 @@ void Slit::reposition() { | |||
811 | frame.x = head_x + ((head_w - frame.width) / 2); | 808 | frame.x = head_x + ((head_w - frame.width) / 2); |
812 | frame.y = head_y; | 809 | frame.y = head_y; |
813 | frame.x_hidden = frame.x; | 810 | frame.x_hidden = frame.x; |
814 | frame.y_hidden = head_y + bevel_width - border_width - frame.height; | 811 | frame.y_hidden = head_y + pixel - border_width - frame.height; |
815 | break; | 812 | break; |
816 | 813 | ||
817 | case BOTTOMCENTER: | 814 | case BOTTOMCENTER: |
818 | frame.x = head_x + ((head_w - frame.width) / 2); | 815 | frame.x = head_x + ((head_w - frame.width) / 2); |
819 | frame.y = head_y + head_h - frame.height - border_width*2; | 816 | frame.y = head_y + head_h - frame.height - border_width*2; |
820 | frame.x_hidden = frame.x; | 817 | frame.x_hidden = frame.x; |
821 | frame.y_hidden = head_y + head_h - bevel_width - border_width; | 818 | frame.y_hidden = head_y + head_h - pixel - border_width; |
822 | break; | 819 | break; |
823 | 820 | ||
824 | case TOPRIGHT: | 821 | case TOPRIGHT: |
825 | frame.x = head_x + head_w - frame.width - border_width*2; | 822 | frame.x = head_x + head_w - frame.width - border_width*2; |
826 | frame.y = head_y; | 823 | frame.y = head_y; |
827 | frame.x_hidden = frame.x; | 824 | frame.x_hidden = frame.x; |
828 | frame.y_hidden = head_y + bevel_width - border_width - frame.height; | 825 | frame.y_hidden = head_y + pixel - border_width - frame.height; |
829 | break; | 826 | break; |
830 | 827 | ||
831 | case RIGHTTOP: | 828 | case RIGHTTOP: |
832 | frame.x = head_x + head_w - frame.width - border_width*2; | 829 | frame.x = head_x + head_w - frame.width - border_width*2; |
833 | frame.y = head_y; | 830 | frame.y = head_y; |
834 | frame.x_hidden = head_x + head_w - bevel_width - border_width; | 831 | frame.x_hidden = head_x + head_w - pixel - border_width; |
835 | frame.y_hidden = head_y; | 832 | frame.y_hidden = head_y; |
836 | break; | 833 | break; |
837 | 834 | ||
838 | case RIGHTCENTER: | 835 | case RIGHTCENTER: |
839 | frame.x = head_x + head_w - frame.width - border_width*2; | 836 | frame.x = head_x + head_w - frame.width - border_width*2; |
840 | frame.y = head_y + ((head_h - frame.height) / 2); | 837 | frame.y = head_y + ((head_h - frame.height) / 2); |
841 | frame.x_hidden = head_x + head_w - bevel_width - border_width; | 838 | frame.x_hidden = head_x + head_w - pixel - border_width; |
842 | frame.y_hidden = frame.y; | 839 | frame.y_hidden = frame.y; |
843 | break; | 840 | break; |
844 | 841 | ||
@@ -846,14 +843,14 @@ void Slit::reposition() { | |||
846 | frame.x = head_x + head_w - frame.width - border_width*2; | 843 | frame.x = head_x + head_w - frame.width - border_width*2; |
847 | frame.y = head_y + head_h - frame.height - border_width*2; | 844 | frame.y = head_y + head_h - frame.height - border_width*2; |
848 | frame.x_hidden = frame.x; | 845 | frame.x_hidden = frame.x; |
849 | frame.y_hidden = head_y + head_h - bevel_width - border_width; | 846 | frame.y_hidden = head_y + head_h - pixel - border_width; |
850 | break; | 847 | break; |
851 | 848 | ||
852 | case RIGHTBOTTOM: | 849 | case RIGHTBOTTOM: |
853 | default: | 850 | default: |
854 | frame.x = head_x + head_w - frame.width - border_width*2; | 851 | frame.x = head_x + head_w - frame.width - border_width*2; |
855 | frame.y = head_y + head_h - frame.height - border_width*2; | 852 | frame.y = head_y + head_h - frame.height - border_width*2; |
856 | frame.x_hidden = head_x + head_w - bevel_width - border_width; | 853 | frame.x_hidden = head_x + head_w - pixel - border_width; |
857 | frame.y_hidden = frame.y; | 854 | frame.y_hidden = frame.y; |
858 | break; | 855 | break; |
859 | } | 856 | } |
diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 2552de9..dbe5e5c 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc | |||
@@ -391,6 +391,8 @@ void Toolbar::reconfigure() { | |||
391 | 391 | ||
392 | updateVisibleState(); | 392 | updateVisibleState(); |
393 | 393 | ||
394 | if (doAutoHide() && !isHidden() && !m_hide_timer.isTiming()) | ||
395 | m_hide_timer.start(); | ||
394 | if (!doAutoHide() && isHidden()) | 396 | if (!doAutoHide() && isHidden()) |
395 | toggleHidden(); | 397 | toggleHidden(); |
396 | 398 | ||
@@ -457,9 +459,6 @@ void Toolbar::reconfigure() { | |||
457 | menu().reconfigure(); | 459 | menu().reconfigure(); |
458 | } | 460 | } |
459 | 461 | ||
460 | if (doAutoHide()) | ||
461 | m_hide_timer.start(); | ||
462 | |||
463 | frame.bevel_w = theme()->bevelWidth(); | 462 | frame.bevel_w = theme()->bevelWidth(); |
464 | // destroy shape if the theme wasn't specified with one, | 463 | // destroy shape if the theme wasn't specified with one, |
465 | // or create one | 464 | // or create one |
@@ -655,7 +654,6 @@ void Toolbar::setPlacement(Toolbar::Placement where) { | |||
655 | head_h = screen().getHeadHeight(head); | 654 | head_h = screen().getHeadHeight(head); |
656 | } | 655 | } |
657 | 656 | ||
658 | int bevel_width = theme()->bevelWidth(); | ||
659 | int border_width = theme()->border().width(); | 657 | int border_width = theme()->border().width(); |
660 | 658 | ||
661 | frame.width = (head_w - 2*border_width) * (*m_rc_width_percent) / 100; | 659 | frame.width = (head_w - 2*border_width) * (*m_rc_width_percent) / 100; |
@@ -682,8 +680,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) { | |||
682 | 680 | ||
683 | 681 | ||
684 | // So we get at least one pixel visible in hidden mode | 682 | // So we get at least one pixel visible in hidden mode |
685 | if (bevel_width <= border_width) | 683 | int pixel = (border_width == 0 ? 1 : 0); |
686 | bevel_width = border_width + 1; | ||
687 | 684 | ||
688 | FbTk::Orientation orient = FbTk::ROT0; | 685 | FbTk::Orientation orient = FbTk::ROT0; |
689 | 686 | ||
@@ -692,7 +689,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) { | |||
692 | frame.x = head_x; | 689 | frame.x = head_x; |
693 | frame.y = head_y; | 690 | frame.y = head_y; |
694 | frame.x_hidden = head_x; | 691 | frame.x_hidden = head_x; |
695 | frame.y_hidden = head_y + bevel_width - border_width - frame.height; | 692 | frame.y_hidden = head_y - border_width - frame.height + pixel; |
696 | if (m_shape.get()) | 693 | if (m_shape.get()) |
697 | m_shape->setPlaces(FbTk::Shape::BOTTOMRIGHT | FbTk::Shape::BOTTOMLEFT); | 694 | m_shape->setPlaces(FbTk::Shape::BOTTOMRIGHT | FbTk::Shape::BOTTOMLEFT); |
698 | break; | 695 | break; |
@@ -701,7 +698,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) { | |||
701 | frame.x = head_x; | 698 | frame.x = head_x; |
702 | frame.y = head_y + head_h - frame.height - border_width*2; | 699 | frame.y = head_y + head_h - frame.height - border_width*2; |
703 | frame.x_hidden = head_x; | 700 | frame.x_hidden = head_x; |
704 | frame.y_hidden = head_y + head_h - bevel_width - border_width; | 701 | frame.y_hidden = head_y + head_h - border_width - pixel; |
705 | if (m_shape.get()) | 702 | if (m_shape.get()) |
706 | m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::TOPLEFT); | 703 | m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::TOPLEFT); |
707 | break; | 704 | break; |
@@ -710,7 +707,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) { | |||
710 | frame.x = head_x + (head_w - frame.width) / 2 - border_width; | 707 | frame.x = head_x + (head_w - frame.width) / 2 - border_width; |
711 | frame.y = head_y; | 708 | frame.y = head_y; |
712 | frame.x_hidden = frame.x; | 709 | frame.x_hidden = frame.x; |
713 | frame.y_hidden = head_y + bevel_width - border_width - frame.height; | 710 | frame.y_hidden = head_y - border_width - frame.height + pixel; |
714 | if (m_shape.get()) | 711 | if (m_shape.get()) |
715 | m_shape->setPlaces(FbTk::Shape::BOTTOMRIGHT | FbTk::Shape::BOTTOMLEFT); | 712 | m_shape->setPlaces(FbTk::Shape::BOTTOMRIGHT | FbTk::Shape::BOTTOMLEFT); |
716 | break; | 713 | break; |
@@ -718,7 +715,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) { | |||
718 | frame.x = head_x + head_w - frame.width - border_width*2; | 715 | frame.x = head_x + head_w - frame.width - border_width*2; |
719 | frame.y = head_y; | 716 | frame.y = head_y; |
720 | frame.x_hidden = frame.x; | 717 | frame.x_hidden = frame.x; |
721 | frame.y_hidden = head_y + bevel_width - border_width - frame.height; | 718 | frame.y_hidden = head_y - border_width - frame.height + pixel; |
722 | if (m_shape.get()) | 719 | if (m_shape.get()) |
723 | m_shape->setPlaces(FbTk::Shape::BOTTOMRIGHT | FbTk::Shape::BOTTOMLEFT); | 720 | m_shape->setPlaces(FbTk::Shape::BOTTOMRIGHT | FbTk::Shape::BOTTOMLEFT); |
724 | break; | 721 | break; |
@@ -727,7 +724,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) { | |||
727 | frame.x = head_x + head_w - frame.width - border_width*2; | 724 | frame.x = head_x + head_w - frame.width - border_width*2; |
728 | frame.y = head_y + head_h - frame.height - border_width*2; | 725 | frame.y = head_y + head_h - frame.height - border_width*2; |
729 | frame.x_hidden = frame.x; | 726 | frame.x_hidden = frame.x; |
730 | frame.y_hidden = head_y + head_h - bevel_width - border_width; | 727 | frame.y_hidden = head_y + head_h - border_width - pixel; |
731 | if (m_shape.get()) | 728 | if (m_shape.get()) |
732 | m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::TOPLEFT); | 729 | m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::TOPLEFT); |
733 | break; | 730 | break; |
@@ -736,7 +733,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) { | |||
736 | frame.x = head_x + (head_w - frame.width) / 2 - border_width; | 733 | frame.x = head_x + (head_w - frame.width) / 2 - border_width; |
737 | frame.y = head_y + head_h - frame.height - border_width*2; | 734 | frame.y = head_y + head_h - frame.height - border_width*2; |
738 | frame.x_hidden = frame.x; | 735 | frame.x_hidden = frame.x; |
739 | frame.y_hidden = head_y + head_h - bevel_width - border_width; | 736 | frame.y_hidden = head_y + head_h - border_width - pixel; |
740 | if (m_shape.get()) | 737 | if (m_shape.get()) |
741 | m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::TOPLEFT); | 738 | m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::TOPLEFT); |
742 | break; | 739 | break; |
@@ -744,7 +741,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) { | |||
744 | orient = FbTk::ROT270; | 741 | orient = FbTk::ROT270; |
745 | frame.x = head_x; | 742 | frame.x = head_x; |
746 | frame.y = head_y + (head_h - frame.height)/2 - border_width; | 743 | frame.y = head_y + (head_h - frame.height)/2 - border_width; |
747 | frame.x_hidden = frame.x - frame.width + bevel_width + border_width; | 744 | frame.x_hidden = frame.x - frame.width - border_width + pixel; |
748 | frame.y_hidden = frame.y; | 745 | frame.y_hidden = frame.y; |
749 | if (m_shape.get()) | 746 | if (m_shape.get()) |
750 | m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::BOTTOMRIGHT); | 747 | m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::BOTTOMRIGHT); |
@@ -753,7 +750,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) { | |||
753 | orient = FbTk::ROT270; | 750 | orient = FbTk::ROT270; |
754 | frame.x = head_x; | 751 | frame.x = head_x; |
755 | frame.y = head_y; | 752 | frame.y = head_y; |
756 | frame.x_hidden = frame.x - frame.width + bevel_width + border_width; | 753 | frame.x_hidden = frame.x - frame.width - border_width + pixel; |
757 | frame.y_hidden = frame.y; | 754 | frame.y_hidden = frame.y; |
758 | if (m_shape.get()) | 755 | if (m_shape.get()) |
759 | m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::BOTTOMRIGHT); | 756 | m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::BOTTOMRIGHT); |
@@ -762,7 +759,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) { | |||
762 | orient = FbTk::ROT270; | 759 | orient = FbTk::ROT270; |
763 | frame.x = head_x; | 760 | frame.x = head_x; |
764 | frame.y = head_y + head_h - frame.height - border_width*2; | 761 | frame.y = head_y + head_h - frame.height - border_width*2; |
765 | frame.x_hidden = frame.x - frame.width + bevel_width + border_width; | 762 | frame.x_hidden = frame.x - frame.width - border_width + pixel; |
766 | frame.y_hidden = frame.y; | 763 | frame.y_hidden = frame.y; |
767 | if (m_shape.get()) | 764 | if (m_shape.get()) |
768 | m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::BOTTOMRIGHT); | 765 | m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::BOTTOMRIGHT); |
@@ -771,7 +768,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) { | |||
771 | orient = FbTk::ROT90; | 768 | orient = FbTk::ROT90; |
772 | frame.x = head_x + head_w - frame.width - border_width*2; | 769 | frame.x = head_x + head_w - frame.width - border_width*2; |
773 | frame.y = head_y + (head_h - frame.height)/2 - border_width; | 770 | frame.y = head_y + (head_h - frame.height)/2 - border_width; |
774 | frame.x_hidden = frame.x + frame.width - bevel_width - border_width; | 771 | frame.x_hidden = frame.x + frame.width + border_width - pixel; |
775 | frame.y_hidden = frame.y; | 772 | frame.y_hidden = frame.y; |
776 | if (m_shape.get()) | 773 | if (m_shape.get()) |
777 | m_shape->setPlaces(FbTk::Shape::TOPLEFT | FbTk::Shape::BOTTOMLEFT); | 774 | m_shape->setPlaces(FbTk::Shape::TOPLEFT | FbTk::Shape::BOTTOMLEFT); |
@@ -780,7 +777,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) { | |||
780 | orient = FbTk::ROT90; | 777 | orient = FbTk::ROT90; |
781 | frame.x = head_x + head_w - frame.width - border_width*2; | 778 | frame.x = head_x + head_w - frame.width - border_width*2; |
782 | frame.y = head_y; | 779 | frame.y = head_y; |
783 | frame.x_hidden = frame.x + frame.width - bevel_width - border_width; | 780 | frame.x_hidden = frame.x + frame.width + border_width - pixel; |
784 | frame.y_hidden = frame.y; | 781 | frame.y_hidden = frame.y; |
785 | if (m_shape.get()) | 782 | if (m_shape.get()) |
786 | m_shape->setPlaces(FbTk::Shape::TOPLEFT | FbTk::Shape::BOTTOMLEFT); | 783 | m_shape->setPlaces(FbTk::Shape::TOPLEFT | FbTk::Shape::BOTTOMLEFT); |
@@ -789,7 +786,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) { | |||
789 | orient = FbTk::ROT90; | 786 | orient = FbTk::ROT90; |
790 | frame.x = head_x + head_w - frame.width - border_width*2; | 787 | frame.x = head_x + head_w - frame.width - border_width*2; |
791 | frame.y = head_y + head_h - frame.height - border_width*2; | 788 | frame.y = head_y + head_h - frame.height - border_width*2; |
792 | frame.x_hidden = frame.x + frame.width - bevel_width - border_width; | 789 | frame.x_hidden = frame.x + frame.width + border_width - pixel; |
793 | frame.y_hidden = frame.y; | 790 | frame.y_hidden = frame.y; |
794 | if (m_shape.get()) | 791 | if (m_shape.get()) |
795 | m_shape->setPlaces(FbTk::Shape::TOPLEFT | FbTk::Shape::BOTTOMLEFT); | 792 | m_shape->setPlaces(FbTk::Shape::TOPLEFT | FbTk::Shape::BOTTOMLEFT); |