File indexing completed on 2024-04-28 16:49:32
0001 /* 0002 * Copyright 2019 Michail Vourlakos <mvourlakos@gmail.com> 0003 * 0004 * This file is part of Latte-Dock 0005 * 0006 * Latte-Dock is free software; you can redistribute it and/or 0007 * modify it under the terms of the GNU General Public License as 0008 * published by the Free Software Foundation; either version 2 of 0009 * the License, or (at your option) any later version. 0010 * 0011 * Latte-Dock is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0014 * GNU General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU General Public License 0017 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0018 */ 0019 0020 #include "trackedviewinfo.h" 0021 0022 //local 0023 #include "windowstracker.h" 0024 #include "../schemecolors.h" 0025 #include "../../view/view.h" 0026 0027 0028 namespace Latte { 0029 namespace WindowSystem { 0030 namespace Tracker { 0031 0032 0033 TrackedViewInfo::TrackedViewInfo(Tracker::Windows *tracker, Latte::View *view) 0034 : TrackedGeneralInfo(tracker) , 0035 m_view(view) 0036 { 0037 m_activities = m_view->activities(); 0038 0039 connect(m_view, &Latte::View::activitiesChanged, this, [&]() { 0040 m_activities = m_view->activities(); 0041 updateTrackingCurrentActivity(); 0042 }); 0043 } 0044 0045 TrackedViewInfo::~TrackedViewInfo() 0046 { 0047 } 0048 0049 bool TrackedViewInfo::activeWindowTouching() const 0050 { 0051 return m_activeWindowTouching; 0052 } 0053 0054 void TrackedViewInfo::setActiveWindowTouching(bool touching) 0055 { 0056 if (m_activeWindowTouching == touching) { 0057 return; 0058 } 0059 0060 m_activeWindowTouching = touching; 0061 } 0062 0063 bool TrackedViewInfo::existsWindowTouching() const 0064 { 0065 return m_existsWindowTouching; 0066 } 0067 0068 void TrackedViewInfo::setExistsWindowTouching(bool touching) 0069 { 0070 if (m_existsWindowTouching == touching) { 0071 return; 0072 } 0073 0074 m_existsWindowTouching = touching; 0075 } 0076 0077 bool TrackedViewInfo::isTouchingBusyVerticalView() const 0078 { 0079 return m_isTouchingBusyVerticalView; 0080 } 0081 0082 void TrackedViewInfo::setIsTouchingBusyVerticalView(bool touching) 0083 { 0084 if (m_isTouchingBusyVerticalView == touching) { 0085 return; 0086 } 0087 0088 m_isTouchingBusyVerticalView = touching; 0089 } 0090 0091 QRect TrackedViewInfo::availableScreenGeometry() const 0092 { 0093 return m_availableScreenGeometry; 0094 } 0095 0096 void TrackedViewInfo::setAvailableScreenGeometry(QRect geometry) 0097 { 0098 if (m_availableScreenGeometry == geometry) { 0099 return; 0100 } 0101 0102 m_availableScreenGeometry = geometry; 0103 } 0104 0105 SchemeColors *TrackedViewInfo::touchingWindowScheme() const 0106 { 0107 return m_touchingWindowScheme; 0108 } 0109 0110 void TrackedViewInfo::setTouchingWindowScheme(SchemeColors *scheme) 0111 { 0112 if (m_touchingWindowScheme == scheme) { 0113 return; 0114 } 0115 0116 m_touchingWindowScheme = scheme; 0117 } 0118 0119 Latte::View *TrackedViewInfo::view() const 0120 { 0121 return m_view; 0122 } 0123 0124 bool TrackedViewInfo::isTracking(const WindowInfoWrap &winfo) const 0125 { 0126 return TrackedGeneralInfo::isTracking(winfo) 0127 && m_availableScreenGeometry.contains(winfo.geometry().center()); 0128 } 0129 0130 } 0131 } 0132 }