MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / CollectWindows

Function CollectWindows

Telegram/SourceFiles/core/external_control.cpp:136–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136[[nodiscard]] std::vector<WindowEntry> CollectWindows() {
137 auto result = std::vector<WindowEntry>();
138 for (const auto widget : QApplication::topLevelWidgets()) {
139 const auto controller = App().findWindow(widget);
140 if (!controller) {
141 continue;
142 }
143 auto already = false;
144 for (const auto &entry : result) {
145 if (entry.controller.get() == controller) {
146 already = true;
147 break;
148 }
149 }
150 if (!already) {
151 result.push_back({ controller, widget->window() });
152 }
153 }
154 ranges::sort(result, [](const WindowEntry &a, const WindowEntry &b) {
155 if (a.controller->isPrimary() != b.controller->isPrimary()) {
156 return a.controller->isPrimary();
157 }
158 return a.controller.get() < b.controller.get();
159 });
160 return result;
161}
162
163[[nodiscard]] QByteArray HandleWindows() {
164 const auto active = App().activeWindow();

Callers 3

HandleWindowsFunction · 0.85
HandleActivateFunction · 0.85
HandleCycleFunction · 0.85

Calls 5

AppClass · 0.85
findWindowMethod · 0.45
getMethod · 0.45
windowMethod · 0.45
isPrimaryMethod · 0.45

Tested by

no test coverage detected