Changeset View
Changeset View
Standalone View
Standalone View
effects/presentwindows/presentwindows.cpp
Show First 20 Lines • Show All 156 Lines • ▼ Show 20 Line(s) | 123 | { | |||
---|---|---|---|---|---|
157 | m_fadeDuration = double(animationTime(150)); | 157 | m_fadeDuration = double(animationTime(150)); | ||
158 | m_showPanel = PresentWindowsConfig::showPanel(); | 158 | m_showPanel = PresentWindowsConfig::showPanel(); | ||
159 | m_leftButtonWindow = (WindowMouseAction)PresentWindowsConfig::leftButtonWindow(); | 159 | m_leftButtonWindow = (WindowMouseAction)PresentWindowsConfig::leftButtonWindow(); | ||
160 | m_middleButtonWindow = (WindowMouseAction)PresentWindowsConfig::middleButtonWindow(); | 160 | m_middleButtonWindow = (WindowMouseAction)PresentWindowsConfig::middleButtonWindow(); | ||
161 | m_rightButtonWindow = (WindowMouseAction)PresentWindowsConfig::rightButtonWindow(); | 161 | m_rightButtonWindow = (WindowMouseAction)PresentWindowsConfig::rightButtonWindow(); | ||
162 | m_leftButtonDesktop = (DesktopMouseAction)PresentWindowsConfig::leftButtonDesktop(); | 162 | m_leftButtonDesktop = (DesktopMouseAction)PresentWindowsConfig::leftButtonDesktop(); | ||
163 | m_middleButtonDesktop = (DesktopMouseAction)PresentWindowsConfig::middleButtonDesktop(); | 163 | m_middleButtonDesktop = (DesktopMouseAction)PresentWindowsConfig::middleButtonDesktop(); | ||
164 | m_rightButtonDesktop = (DesktopMouseAction)PresentWindowsConfig::rightButtonDesktop(); | 164 | m_rightButtonDesktop = (DesktopMouseAction)PresentWindowsConfig::rightButtonDesktop(); | ||
165 | m_preciseMatch = PresentWindowsConfig::preciseMatch(); | ||||
165 | 166 | | |||
166 | // touch screen edges | 167 | // touch screen edges | ||
167 | const QVector<ElectricBorder> relevantBorders{ElectricLeft, ElectricTop, ElectricRight, ElectricBottom}; | 168 | const QVector<ElectricBorder> relevantBorders{ElectricLeft, ElectricTop, ElectricRight, ElectricBottom}; | ||
168 | for (auto e : relevantBorders) { | 169 | for (auto e : relevantBorders) { | ||
169 | effects->unregisterTouchBorder(e, m_exposeAction); | 170 | effects->unregisterTouchBorder(e, m_exposeAction); | ||
170 | effects->unregisterTouchBorder(e, m_exposeAllAction); | 171 | effects->unregisterTouchBorder(e, m_exposeAllAction); | ||
171 | effects->unregisterTouchBorder(e, m_exposeClassAction); | 172 | effects->unregisterTouchBorder(e, m_exposeClassAction); | ||
172 | } | 173 | } | ||
▲ Show 20 Lines • Show All 726 Lines • ▼ Show 20 Line(s) | 870 | } else if (a == m_atomWindows) { | |||
899 | m_managerWindow = w; | 900 | m_managerWindow = w; | ||
900 | setActive(true); | 901 | setActive(true); | ||
901 | } | 902 | } | ||
902 | } | 903 | } | ||
903 | 904 | | |||
904 | //----------------------------------------------------------------------------- | 905 | //----------------------------------------------------------------------------- | ||
905 | // Window rearranging | 906 | // Window rearranging | ||
906 | 907 | | |||
908 | namespace { | ||||
909 | bool titleMatchesUnpreciseFilter(const QString& title, const QString& filter) { | ||||
910 | auto it = std::begin(title); | ||||
911 | | ||||
912 | for (const QChar f: filter) { | ||||
913 | it = std::find_if(it, std::end(title), [f](QChar c){ return c.toLower() == f.toLower(); }); | ||||
914 | | ||||
915 | if (it == std::end(title)) | ||||
916 | return false; | ||||
917 | | ||||
918 | it++; | ||||
919 | } | ||||
920 | | ||||
921 | return true; | ||||
922 | } | ||||
923 | | ||||
924 | bool preciseMatchFilter(EffectWindow *w, const QString& filter) { | ||||
925 | return w->caption().contains(filter, Qt::CaseInsensitive) || | ||||
926 | w->windowClass().contains(filter, Qt::CaseInsensitive) || | ||||
927 | w->windowRole().contains(filter, Qt::CaseInsensitive); | ||||
928 | } | ||||
929 | | ||||
930 | bool impreciseMatchFilter(EffectWindow *w, const QString& filter) { | ||||
931 | return titleMatchesUnpreciseFilter(w->caption(), filter) || | ||||
932 | titleMatchesUnpreciseFilter(w->windowClass(), filter) || | ||||
933 | titleMatchesUnpreciseFilter(w->windowRole(), filter); | ||||
934 | } | ||||
935 | | ||||
936 | bool titleMatchesFilter(EffectWindow *w, const QString& filter, bool preciseMatch) { | ||||
937 | return preciseMatch ? preciseMatchFilter(w, filter) : impreciseMatchFilter(w, filter); | ||||
938 | } | ||||
939 | } | ||||
940 | | ||||
907 | void PresentWindowsEffect::rearrangeWindows() | 941 | void PresentWindowsEffect::rearrangeWindows() | ||
908 | { | 942 | { | ||
909 | if (!m_activated) | 943 | if (!m_activated) | ||
910 | return; | 944 | return; | ||
911 | 945 | | |||
912 | effects->addRepaintFull(); // Trigger the first repaint | 946 | effects->addRepaintFull(); // Trigger the first repaint | ||
913 | if (m_closeView) | 947 | if (m_closeView) | ||
914 | m_closeView->hide(); | 948 | m_closeView->hide(); | ||
Show All 14 Lines | 958 | foreach (EffectWindow * w, m_motionManager.managedWindows()) { | |||
929 | winData->visible = true; | 963 | winData->visible = true; | ||
930 | } | 964 | } | ||
931 | } else { | 965 | } else { | ||
932 | // Can we move this filtering somewhere else? | 966 | // Can we move this filtering somewhere else? | ||
933 | foreach (EffectWindow * w, m_motionManager.managedWindows()) { | 967 | foreach (EffectWindow * w, m_motionManager.managedWindows()) { | ||
934 | DataHash::iterator winData = m_windowData.find(w); | 968 | DataHash::iterator winData = m_windowData.find(w); | ||
935 | if (winData == m_windowData.end() || winData->deleted) | 969 | if (winData == m_windowData.end() || winData->deleted) | ||
936 | continue; // don't include closed windows | 970 | continue; // don't include closed windows | ||
937 | if (w->caption().contains(m_windowFilter, Qt::CaseInsensitive) || | 971 | if (titleMatchesFilter(w, m_windowFilter, m_preciseMatch)) { | ||
938 | w->windowClass().contains(m_windowFilter, Qt::CaseInsensitive) || | | |||
939 | w->windowRole().contains(m_windowFilter, Qt::CaseInsensitive)) { | | |||
940 | windowlist.append(w); | 972 | windowlist.append(w); | ||
941 | windowlists[w->screen()].append(w); | 973 | windowlists[w->screen()].append(w); | ||
942 | winData->visible = true; | 974 | winData->visible = true; | ||
943 | } else | 975 | } else | ||
944 | winData->visible = false; | 976 | winData->visible = false; | ||
945 | } | 977 | } | ||
946 | } | 978 | } | ||
947 | if (windowlist.isEmpty()) { | 979 | if (windowlist.isEmpty()) { | ||
▲ Show 20 Lines • Show All 1120 Lines • Show Last 20 Lines |