diff options
Diffstat (limited to 'src/Tab.cc')
-rw-r--r-- | src/Tab.cc | 117 |
1 files changed, 49 insertions, 68 deletions
@@ -60,11 +60,11 @@ Tab::Tab(FluxboxWindow *win, Tab *prev, Tab *next) { | |||
60 | if ((m_win->screen->getTabPlacement() == PLeft || | 60 | if ((m_win->screen->getTabPlacement() == PLeft || |
61 | m_win->screen->getTabPlacement() == PRight) && | 61 | m_win->screen->getTabPlacement() == PRight) && |
62 | m_win->screen->isTabRotateVertical()) { | 62 | m_win->screen->isTabRotateVertical()) { |
63 | m_size_w = Fluxbox::instance()->getTabHeight(); | 63 | m_size_w = m_win->screen->getTabHeight(); |
64 | m_size_h = Fluxbox::instance()->getTabWidth(); | 64 | m_size_h = m_win->screen->getTabWidth(); |
65 | } else { | 65 | } else { |
66 | m_size_w = Fluxbox::instance()->getTabWidth(); | 66 | m_size_w = m_win->screen->getTabWidth(); |
67 | m_size_h = Fluxbox::instance()->getTabHeight(); | 67 | m_size_h = m_win->screen->getTabHeight(); |
68 | } | 68 | } |
69 | 69 | ||
70 | createTabWindow(); | 70 | createTabWindow(); |
@@ -297,7 +297,7 @@ void Tab::shade() { | |||
297 | for(Tab *first = getFirst(this); first != 0; first = first->m_next) { | 297 | for(Tab *first = getFirst(this); first != 0; first = first->m_next) { |
298 | if (first==this) | 298 | if (first==this) |
299 | continue; | 299 | continue; |
300 | first->m_win->shade(); | 300 | first->m_win->shade(); |
301 | } | 301 | } |
302 | 302 | ||
303 | if (m_win->screen->getTabPlacement() == PLeft || | 303 | if (m_win->screen->getTabPlacement() == PLeft || |
@@ -633,7 +633,7 @@ void Tab::buttonReleaseEvent(XButtonEvent *be) { | |||
633 | dest_y -= (m_win->frame.height / 2) - (m_size_h / 2); | 633 | dest_y -= (m_win->frame.height / 2) - (m_size_h / 2); |
634 | break; | 634 | break; |
635 | case ALeft: | 635 | case ALeft: |
636 | dest_y -= m_win->frame.height + m_size_h; | 636 | dest_y -= m_win->frame.height - m_size_h; |
637 | break; | 637 | break; |
638 | } | 638 | } |
639 | break; | 639 | break; |
@@ -645,13 +645,13 @@ void Tab::buttonReleaseEvent(XButtonEvent *be) { | |||
645 | dest_y -= (m_win->frame.height / 2) - (m_size_h / 2); | 645 | dest_y -= (m_win->frame.height / 2) - (m_size_h / 2); |
646 | break; | 646 | break; |
647 | case ALeft: | 647 | case ALeft: |
648 | dest_y -= m_win->frame.height + m_size_h; | 648 | dest_y -= m_win->frame.height - m_size_h; |
649 | break; | 649 | break; |
650 | } | 650 | } |
651 | break; | 651 | break; |
652 | } | 652 | } |
653 | //TODO: this causes an calculate increase event, even if | 653 | //TODO: this causes an calculate increase event, even if we |
654 | // only moving a tab! | 654 | // only are moving a window |
655 | m_win->configure(dest_x, dest_y, m_win->frame.width, m_win->frame.height); | 655 | m_win->configure(dest_x, dest_y, m_win->frame.width, m_win->frame.height); |
656 | } | 656 | } |
657 | } | 657 | } |
@@ -831,73 +831,56 @@ void Tab::insert(Tab *tab) { | |||
831 | 831 | ||
832 | m_next = tab; | 832 | m_next = tab; |
833 | 833 | ||
834 | bool resize_tabs = false; | ||
835 | |||
834 | //TODO: cleanup and optimize | 836 | //TODO: cleanup and optimize |
835 | //move and resize all windows in the tablist we inserted | 837 | //move and resize all windows in the tablist we inserted |
836 | //only from first tab of the inserted chain to the last | 838 | //only from first tab of the inserted chain to the last |
837 | for (; tab!=last->m_next; tab=tab->m_next) { | 839 | for (; tab!=last->m_next; tab=tab->m_next) { |
838 | if (m_win->isShaded() != tab->m_win->isShaded()) { | 840 | if (m_win->isShaded() != tab->m_win->isShaded()) { |
841 | tab->m_stoptabs = true; // we don't want any actions performed on the | ||
842 | // tabs, just the tab windows! | ||
839 | if (m_win->screen->getTabPlacement() == PLeft || | 843 | if (m_win->screen->getTabPlacement() == PLeft || |
840 | m_win->screen->getTabPlacement() == PRight) { | 844 | m_win->screen->getTabPlacement() == PRight) |
841 | // if window were grouping to, we need to shade the tab window | 845 | resize_tabs = true; |
842 | // _after_ reconfigure | ||
843 | if(m_win->isShaded()) { | ||
844 | tab->m_win->configure(m_win->frame.x, m_win->frame.y, | ||
845 | m_win->frame.width, m_win->frame.height); | ||
846 | tab->m_win->shade(); | ||
847 | // don't need unshading as configure will fix that for me | ||
848 | } else { | ||
849 | if ((m_win->frame.width != tab->m_win->frame.width) || | ||
850 | (m_win->frame.height != tab->m_win->frame.height)) { | ||
851 | tab->m_win->configure(m_win->frame.x, m_win->frame.y, | ||
852 | m_win->frame.width, m_win->frame.height); | ||
853 | } else // need to change shade state as configure _won't_ | ||
854 | // do the trick if the new and old size is the same | ||
855 | tab->m_win->shade(); | ||
856 | } | ||
857 | |||
858 | tab->resizeGroup(); | ||
859 | tab->calcIncrease(); | ||
860 | |||
861 | } else { // PTop & PBottom | ||
862 | if(m_win->isShaded()) { | ||
863 | 846 | ||
847 | // if the window we are grouping to, we need to shade the tab window | ||
848 | // _after_ reconfigure | ||
849 | if(m_win->isShaded()) { | ||
864 | tab->m_win->configure(m_win->frame.x, m_win->frame.y, | 850 | tab->m_win->configure(m_win->frame.x, m_win->frame.y, |
865 | m_win->frame.width, m_win->frame.height); | 851 | m_win->frame.width, m_win->frame.height); |
866 | tab->m_win->shade(); | 852 | tab->m_win->shade(); |
867 | // don't need unshading as configure will fix that for me | 853 | } else { |
868 | } else { | 854 | tab->m_win->shade(); // switch to correct shade state |
869 | if ((m_win->frame.width != tab->m_win->frame.width) || | 855 | tab->m_win->configure(m_win->frame.x, m_win->frame.y, |
870 | (m_win->frame.height != tab->m_win->frame.height)) { | 856 | m_win->frame.width, m_win->frame.height); |
871 | |||
872 | tab->m_win->configure(m_win->frame.x, m_win->frame.y, | ||
873 | m_win->frame.width, m_win->frame.height); | ||
874 | } else | ||
875 | tab->m_win->shade(); | ||
876 | } | ||
877 | } | 857 | } |
878 | 858 | ||
879 | // both window have the same shaded state | 859 | tab->m_stoptabs = false; |
880 | } else { | ||
881 | if ((m_win->frame.width != tab->m_win->frame.width) || | ||
882 | (m_win->frame.height != tab->m_win->frame.height)) { | ||
883 | 860 | ||
884 | tab->m_win->configure(m_win->frame.x, m_win->frame.y, | 861 | // both window have the same shaded state and have different sizes, |
885 | m_win->frame.width, m_win->frame.height); | 862 | // checking this so that I'll only do shade on windows if configure did |
863 | // anything. | ||
864 | } else if ((m_win->frame.width != tab->m_win->frame.width) || | ||
865 | (m_win->frame.height != tab->m_win->frame.height)) { | ||
886 | 866 | ||
887 | // need to shade the tab window as configure will mess it up | 867 | tab->m_win->configure(m_win->frame.x, m_win->frame.y, |
888 | if (m_win->isShaded()) | 868 | m_win->frame.width, m_win->frame.height); |
889 | tab->m_win->shade(); | ||
890 | } | ||
891 | } | ||
892 | 869 | ||
893 | // TODO: should check if alignemnt is left or right, | 870 | // need to shade the tab window as configure will mess it up |
894 | // cus then resize is allready done resize tabs | 871 | if (m_win->isShaded()) |
895 | if(m_win->screen->getTabAlignment() == ARelative) { | 872 | tab->m_win->shade(); |
896 | tab->resizeGroup(); | ||
897 | tab->calcIncrease(); | ||
898 | } | 873 | } |
899 | m_win->tab->setPosition(); | 874 | } |
900 | } | 875 | |
876 | // resize if in relative mode or resize_tabs is true | ||
877 | if(m_win->screen->getTabAlignment() == ARelative || | ||
878 | resize_tabs) { | ||
879 | resizeGroup(); | ||
880 | calcIncrease(); | ||
881 | } | ||
882 | // reposition tabs | ||
883 | setPosition(); | ||
901 | } | 884 | } |
902 | 885 | ||
903 | //---------- disconnect() -------------- | 886 | //---------- disconnect() -------------- |
@@ -970,11 +953,11 @@ void Tab::resizeGroup(void) { | |||
970 | m_win->screen->getTabPlacement() == PRight) && | 953 | m_win->screen->getTabPlacement() == PRight) && |
971 | m_win->screen->isTabRotateVertical() && | 954 | m_win->screen->isTabRotateVertical() && |
972 | !m_win->isShaded()) { | 955 | !m_win->isShaded()) { |
973 | first->setTabWidth(Fluxbox::instance()->getTabHeight()); | 956 | first->setTabWidth(m_win->screen->getTabHeight()); |
974 | first->setTabHeight(Fluxbox::instance()->getTabWidth()); | 957 | first->setTabHeight(m_win->screen->getTabWidth()); |
975 | } else { | 958 | } else { |
976 | first->setTabWidth(Fluxbox::instance()->getTabWidth()); | 959 | first->setTabWidth(m_win->screen->getTabWidth()); |
977 | first->setTabHeight(Fluxbox::instance()->getTabHeight()); | 960 | first->setTabHeight(m_win->screen->getTabHeight()); |
978 | } | 961 | } |
979 | //TODO: do I have to set this all the time? | 962 | //TODO: do I have to set this all the time? |
980 | first->m_configured = true; //used in Fluxbox::reconfigure() | 963 | first->m_configured = true; //used in Fluxbox::reconfigure() |
@@ -1032,8 +1015,7 @@ unsigned int Tab::calcCenterYPos() { | |||
1032 | 1015 | ||
1033 | //------- getTabPlacementString ---------- | 1016 | //------- getTabPlacementString ---------- |
1034 | // Returns the tabplacement string of the | 1017 | // Returns the tabplacement string of the |
1035 | // tabplacement number on success else | 1018 | // tabplacement number on success else 0. |
1036 | // 0. | ||
1037 | //---------------------------------------- | 1019 | //---------------------------------------- |
1038 | const char *Tab::getTabPlacementString(int placement) { | 1020 | const char *Tab::getTabPlacementString(int placement) { |
1039 | for (int i=0; i<(pnone / 5); i++) { | 1021 | for (int i=0; i<(pnone / 5); i++) { |
@@ -1059,8 +1041,7 @@ int Tab::getTabPlacementNum(const char *string) { | |||
1059 | 1041 | ||
1060 | //------- getTabAlignmentString ---------- | 1042 | //------- getTabAlignmentString ---------- |
1061 | // Returns the tabplacement string of the | 1043 | // Returns the tabplacement string of the |
1062 | // tabplacement number on success else | 1044 | // tabplacement number on success else 0. |
1063 | // 0. | ||
1064 | //---------------------------------------- | 1045 | //---------------------------------------- |
1065 | const char *Tab::getTabAlignmentString(int placement) { | 1046 | const char *Tab::getTabAlignmentString(int placement) { |
1066 | for (int i=0; i<anone; i++) { | 1047 | for (int i=0; i<anone; i++) { |