void SessionManager::checkGUISessionShift() { // this method doesn't do mutex locking - similar reasons to // sessionEntryAction(), see above for details Group* target; SessionGroup* parent = videoSessions; // just loop over video & available video for now for ( unsigned int i = 0; i < 2; i++ ) { if ( parent == videoSessions ) { target = availableVideoSessions; } else if ( parent == availableVideoSessions ) { target = videoSessions; } std::vector<RectangleBase*> outsideList = parent->checkMemberIntersect(); bool gotIntersect = false; for ( unsigned int i = 0; i < outsideList.size(); i++ ) { SessionEntry* entry = dynamic_cast<SessionEntry*>( outsideList[i] ); if ( entry == NULL ) { gravUtil::logWarning( "SessionManager::checkGUISessionShift: " "invalid SessionGroup child?\n" ); } else { // check intersect with projected destination, shift if so if ( entry->destIntersect( target ) ) { // we have to use the external method here to ensure that // the side window GUI stays accurate - that will in turn // call the shiftSession() method in this class sessionTree->shiftSession( entry->getAddress(), false ); gotIntersect = true; } } } // rearrange when there was at least one object moved outside of the // group bounds but not in the target if ( outsideList.size() > 0 && !gotIntersect ) { parent->rearrange(); } parent = availableVideoSessions; } }
SessionEntry* SessionManager::findSessionByAddress( std::string address, SessionType type ) { Group* sessions = sessionMap[ type ]; SessionEntry* session; for ( int j = 0; j < sessions->numObjects(); j++ ) { session = dynamic_cast<SessionEntry*>( (*sessions)[j] ); if ( session != NULL && session->getAddress().compare( address ) == 0 ) return session; } gravUtil::logWarning( "SessionManager::findSessionByAddress: session %s " "not found\n", address.c_str() ); return NULL; }
std::string SessionManager::getCurrentRotateSessionAddress() { lockSessions(); if ( rotatePos != -1 && rotatePos < availableVideoSessions->numObjects() ) { SessionEntry* entry = static_cast<SessionEntry*>( (*availableVideoSessions)[ rotatePos ] ); if ( entry != NULL ) { unlockSessions(); return entry->getAddress(); } } gravUtil::logVerbose( "SessionManager::getCurrentRotateSessionAddress: " "failed to find valid session (rotate position %i)", rotatePos ); unlockSessions(); return ""; }