| 1325 | } |
| 1326 | |
| 1327 | void Server::handleToggleScreenEvent(const Event &) |
| 1328 | { |
| 1329 | // Get the list of connected screens in config order |
| 1330 | std::vector<std::string> screens; |
| 1331 | getClients(screens); |
| 1332 | |
| 1333 | if (screens.size() < 2) { |
| 1334 | LOG_ERR("not enough screens to toggle"); |
| 1335 | return; |
| 1336 | } |
| 1337 | |
| 1338 | // Find the current active screen |
| 1339 | std::string currentScreen = getName(m_active); |
| 1340 | auto it = std::ranges::find(screens, currentScreen); |
| 1341 | if (it == screens.end()) { |
| 1342 | LOG_ERR("current screen not found in list"); |
| 1343 | return; |
| 1344 | } |
| 1345 | |
| 1346 | // Find the next screen |
| 1347 | auto nextIt = it + 1; |
| 1348 | if (nextIt == screens.end()) { |
| 1349 | nextIt = screens.begin(); |
| 1350 | } |
| 1351 | |
| 1352 | // Find the client for the next screen |
| 1353 | ClientList::const_iterator clientIt = m_clients.find(*nextIt); |
| 1354 | if (clientIt == m_clients.end()) { |
| 1355 | LOG_ERR("next screen not active"); |
| 1356 | return; |
| 1357 | } |
| 1358 | |
| 1359 | jumpToScreen(clientIt->second); |
| 1360 | } |
| 1361 | |
| 1362 | void Server::handleKeyboardBroadcastEvent(const Event &event) |
| 1363 | { |