LOGIN / SIGN UP
2 Author: Claes Nästén
Date: Sun Nov 29 11:28:37 +0100 2009
Subject: Split up and make auto-group code ready for #155

src/WindowManager.cc
 
1788 @@ -1788,7 +1788,28 @@
1788 _mru_list.remove(frame);
1789 }
1790
1791 //! @brief Tries to find a Frame to autogroup with
1792 /**
1793 * Match Frame against autoproperty.
1794 */
1795 bool
1796 WindowManager::findGroupMatchProperty(Frame *frame, AutoProperty *property)
1797 {
1798 #define MATCH_GROUP(F,P) \
1799 ((P->group_global || ((F)->isMapped())) && \
1800 ((P->group_size == 0) || (signed((F)->size()) < P->group_size)) && \
1801 ((((F)->getClassHint()->group.size() > 0) \
1802 ? ((F)->getClassHint()->group == P->group_name) : false) || \
1803 AutoProperties::matchAutoClass(*(F)->getClassHint(), (Property*) P)))
1804
1805 return MATCH_GROUP(frame, property);
1806 #undef MATCH_GROUP
1807 }
1808
1809 /**
1810 * Tries to find a Frame to autogroup with. This is called recursively
1811 * if workspace specific matching is on to avoid conflicts with the
1812 * global property.
1813 */
1814 Frame*
1815 WindowManager::findGroup(AutoProperty *property)
1816 {
...  
1818 @@ -1797,40 +1818,41 @@
1818 }
1819
1820 Frame *frame = 0;
1821 frame = findGroupMatch(property);
1822
1802 #define MATCH_GROUP(F,P) \
1803 ((P->group_global || ((F)->isMapped())) && \
1804 ((P->group_size == 0) || (signed((F)->size()) < P->group_size)) && \
1805 ((((F)->getClassHint()->group.size() > 0) \
1806 ? ((F)->getClassHint()->group == P->group_name) : false) || \
1807 AutoProperties::matchAutoClass(*(F)->getClassHint(), (Property*) P)))
1829 return frame;
1830 }
1831
1811 // try to match the focused window first
1812 if (property->group_focused_first &&
1813 PWinObj::getFocusedPWinObj() &&
1814 (PWinObj::getFocusedPWinObj()->getType() == PWinObj::WO_CLIENT)) {
1836 /**
1837 * Do matching against Frames searching for a suitable Frame for
1838 * grouping.
1839 */
1840 Frame*
1841 WindowManager::findGroupMatch(AutoProperty *property)
1842 {
1843 Frame *frame = 0;
1844
1845 // Matching against the focused window first if requested
1846 if (property->group_focused_first
1847 && PWinObj::isFocusedPWinObj(PWinObj::WO_CLIENT)) {
1848 Frame *fo_frame =
1849 static_cast<Frame*>(PWinObj::getFocusedPWinObj()->getParent());
1829
1830 if (MATCH_GROUP(fo_frame, property)) {
1852 if (findGroupMatchProperty(fo_frame, property)) {
1853 frame = fo_frame;
1854 }
1855 }
1856
1836 // search the list of frames
1858 // Moving on to the rest of the frames.
1859 if (! frame) {
1860 list<Frame*>::iterator it(Frame::frame_begin());
1861 for (; it != Frame::frame_end(); ++it) {
1841 if (MATCH_GROUP(*it, property)) {
1863 if (findGroupMatchProperty(*it, property)) {
1864 frame = *it;
1865 break;
1866 }
1867 }
1868 }
1869
1849 #undef MATCH_GROUP
1850
1872 return frame;
1873 }
1874
...