From 3cd6ecdb8217d46f00d7e4f59362685434ea4ec5 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Fri, 3 Jan 2014 19:11:49 +0200 Subject: [PATCH 1/5] Add deadlock counter to prevent endless loop (issue #73) --HG-- branch : misc-patches --- code/nel/src/gui/widget_manager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/nel/src/gui/widget_manager.cpp b/code/nel/src/gui/widget_manager.cpp index 3ec11f215..ccfa14c63 100644 --- a/code/nel/src/gui/widget_manager.cpp +++ b/code/nel/src/gui/widget_manager.cpp @@ -1094,7 +1094,10 @@ namespace NLGUI bool updateCoordCalled= false; // updateCoords the window only if the master group is his parent and if need it // do it until updateCoords() no more invalidate coordinates!! - while (pIG->getParent()==rMG.Group && (pIG->getInvalidCoords()>0)) + + // add deadlock counter to prevent endless loop (Issue #73: web browser long scroll lockup) + int deadlock = 10; + while (--deadlock > 0 && pIG->getParent()==rMG.Group && (pIG->getInvalidCoords()>0)) { bRecomputeCtrlUnderPtr = true; // Update as many pass wanted (3 time for complex resizing, 1 for scroll for example) From 0bad9f2f5e37cf990244938d5a0e59bf1888737c Mon Sep 17 00:00:00 2001 From: Nimetu Date: Fri, 3 Jan 2014 20:31:14 +0200 Subject: [PATCH 2/5] Fix inventory items draggable state (issue #78) --HG-- branch : misc-patches --- code/ryzom/client/src/interface_v3/dbgroup_list_sheet.cpp | 7 +++++++ code/ryzom/client/src/interface_v3/dbgroup_list_sheet.h | 1 + .../client/src/interface_v3/dbgroup_list_sheet_text.cpp | 6 ++++++ .../client/src/interface_v3/dbgroup_list_sheet_text.h | 1 + 4 files changed, 15 insertions(+) diff --git a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.cpp b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.cpp index b5092be67..74bd2be47 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.cpp +++ b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.cpp @@ -84,6 +84,8 @@ CDBGroupListSheet::CDBGroupListSheet(const TCtorParam ¶m) _CacheAnimalStatus= -1; _ListLeaveSpace= false; + + _Draggable = false; } // *************************************************************************** @@ -227,6 +229,10 @@ bool CDBGroupListSheet::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) _AnimalStatus= NLGUI::CDBManager::getInstance()->getDbProp((const char*)prop, false); } + // issue #78: dragable is not parsed by _CtrlInfo, need to do it here. + prop = (char*) xmlGetProp( cur, (xmlChar*)"dragable" ); + if (prop) _Draggable = convertBool(prop); + return true; } @@ -864,6 +870,7 @@ void CDBGroupListSheet::setup() ctrl->setToolTipParent(getToolTipParent()); ctrl->setToolTipParentPosRef(getToolTipParentPosRef()); ctrl->setToolTipPosRef(getToolTipPosRef()); + ctrl->setDraggable(_Draggable); // link on the element i+_StartDbIdx if (_DisplayEmptySlot) { diff --git a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.h b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.h index a78ce8308..546b80b0d 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.h +++ b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.h @@ -171,6 +171,7 @@ protected: bool _Squarify : 1; bool _CanDrop : 1; + bool _Draggable : 1; // Children bool _Setuped; diff --git a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp index 9d108926c..a05d1e4aa 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp +++ b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp @@ -69,6 +69,7 @@ CDBGroupListSheetText::CDBGroupListSheetText(const TCtorParam ¶m) _AnimalStatus= NULL; _CacheAnimalStatus= -1; _CanDrop= false; + _Draggable= false; for(uint i=0;igetDbProp((const char*)prop, false); } + // issue #78: dragable is not parsed by _CtrlInfo, need to do it here. + prop = (char*) xmlGetProp( cur, (xmlChar*)"dragable" ); + if (prop) _Draggable = convertBool(prop); + return true; } @@ -855,6 +860,7 @@ void CDBGroupListSheetText::setup() ctrl->setParamsOnLeftClick(toString(i)); ctrl->setActionOnRightClick("lst_rclick"); ctrl->setParamsOnRightClick(toString(i)); + ctrl->setDraggable(_Draggable); // Add it to the list. _List->addCtrl(ctrl); diff --git a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.h b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.h index 2ae903c25..e607883d3 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.h +++ b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.h @@ -224,6 +224,7 @@ protected: bool _GrayTextWithCtrlState; bool _CanDrop; + bool _Draggable; // Common Info for ctrl and group CCtrlSheetInfo _CtrlInfo; From 4c2531474a2ab29e21107f020ca643557752d5d9 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Fri, 3 Jan 2014 19:51:50 +0200 Subject: [PATCH 3/5] Fix typo (issue #70) --HG-- branch : misc-patches --- code/nel/include/nel/gui/group_container_base.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/nel/include/nel/gui/group_container_base.h b/code/nel/include/nel/gui/group_container_base.h index fe3fc8d07..3e9d1c8bf 100644 --- a/code/nel/include/nel/gui/group_container_base.h +++ b/code/nel/include/nel/gui/group_container_base.h @@ -74,14 +74,14 @@ namespace NLGUI REFLECT_SINT32("rollover_container_alpha", getRolloverAlphaContainerAsSInt32, setRolloverAlphaContainer); REFLECT_BOOL("use_global_alpha_settings", isUsingGlobalAlpha, setUseGlobalAlpha); REFLECT_STRING("on_alpha_settings_changed", getAHOnAlphaSettingsChanged, setAHOnAlphaSettingsChanged); - REFLECT_STRING("on_alpha_settings_changed_aparams", getAHOnAlphaSettingsChangedParams, setAHOnAlphaSettingsChangedParams); + REFLECT_STRING("on_alpha_settings_changed_params", getAHOnAlphaSettingsChangedParams, setAHOnAlphaSettingsChangedParams); REFLECT_EXPORT_END virtual bool isMoving() const{ return false; } // Get the header color draw. NB: depends if grayed, and if active. virtual NLMISC::CRGBA getDrawnHeaderColor () const{ return NLMISC::CRGBA(); }; - + uint8 getCurrentContainerAlpha() const{ return _CurrentContainerAlpha; } uint8 getCurrentContentAlpha() const{ return _CurrentContentAlpha; } @@ -92,7 +92,7 @@ namespace NLGUI protected: void triggerAlphaSettingsChangedAH(); - + uint8 _CurrentContainerAlpha; uint8 _CurrentContentAlpha; uint8 _ContainerAlpha; From 5b09380bff4b1bc3fc731166235dfd8f7d3d5b0b Mon Sep 17 00:00:00 2001 From: Nimetu Date: Fri, 3 Jan 2014 22:43:00 +0200 Subject: [PATCH 4/5] Hide over the limit landmarks instead deleting them --HG-- branch : misc-patches --- code/ryzom/client/src/continent_manager.cpp | 28 +++---------- code/ryzom/client/src/continent_manager.h | 4 +- .../client/src/interface_v3/group_map.cpp | 28 ++++++------- .../ryzom/client/src/interface_v3/group_map.h | 2 - .../src/interface_v3/interface_manager.cpp | 39 +++++++++---------- 5 files changed, 40 insertions(+), 61 deletions(-) diff --git a/code/ryzom/client/src/continent_manager.cpp b/code/ryzom/client/src/continent_manager.cpp index 5eeb1a232..87172ce1a 100644 --- a/code/ryzom/client/src/continent_manager.cpp +++ b/code/ryzom/client/src/continent_manager.cpp @@ -529,36 +529,18 @@ void CContinentManager::serialUserLandMarks(NLMISC::IStream &f) f.serialCont(dummy); } } - - // The number of stored landmarks is not checked at this time, but if we receive a - // lower value in the server database, we will cut down using checkNumberOfUserLandmarks() } } //----------------------------------------------- -// checkNumberOfLandmarks +// updateUserLandMarks //----------------------------------------------- -void CContinentManager::checkNumberOfUserLandmarks( uint maxNumber ) +void CContinentManager::updateUserLandMarks() { - for ( TContinents::iterator it=_Continents.begin(); it!=_Continents.end(); ++it ) - { - CContinent *cont = (*it).second; - if ( cont->UserLandMarks.size() > maxNumber ) - { - // Just cut down the last landmarks (in case of hacked file) - if ( cont == _Current ) - { - CGroupMap *pMap = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:actual_map")); - if ( pMap ) - pMap->removeExceedingUserLandMarks( maxNumber ); - } - else - { - cont->UserLandMarks.resize( maxNumber ); - } - } - } + CGroupMap *pMap = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:actual_map")); + if ( pMap ) + pMap->updateUserLandMarks(); } diff --git a/code/ryzom/client/src/continent_manager.h b/code/ryzom/client/src/continent_manager.h index f9d3a64ea..c51498967 100644 --- a/code/ryzom/client/src/continent_manager.h +++ b/code/ryzom/client/src/continent_manager.h @@ -112,8 +112,8 @@ public: // load / saves all user landMarks void serialUserLandMarks(NLMISC::IStream &f); - // ensure the number of landmarks per continent does not exceed maxNumber - void checkNumberOfUserLandmarks( uint maxNumber ); + // rebuild visible landmarks on current map + void updateUserLandMarks(); // load / saves all fow maps void serialFOWMaps(); diff --git a/code/ryzom/client/src/interface_v3/group_map.cpp b/code/ryzom/client/src/interface_v3/group_map.cpp index 8cf3e4a23..31d70d0d7 100644 --- a/code/ryzom/client/src/interface_v3/group_map.cpp +++ b/code/ryzom/client/src/interface_v3/group_map.cpp @@ -2390,8 +2390,9 @@ void CGroupMap::createContinentLandMarks() // Continent Landmarks createLMWidgets(_CurContinent->ContLandMarks); + uint nbUserLandMarks = std::min( uint(_CurContinent->UserLandMarks.size()), CContinent::getMaxNbUserLandMarks()); // User Landmarks - for(k = 0; k < _CurContinent->UserLandMarks.size(); ++k) + for(k = 0; k < nbUserLandMarks; ++k) { NLMISC::CVector2f mapPos; worldToMap(mapPos, _CurContinent->UserLandMarks[k].Pos); @@ -2429,7 +2430,8 @@ void CGroupMap::updateUserLandMarks() removeLandMarks(_UserLM); // Re create User Landmarks - for(k = 0; k < _CurContinent->UserLandMarks.size(); ++k) + uint nbUserLandMarks = std::min( uint(_CurContinent->UserLandMarks.size()), CContinent::getMaxNbUserLandMarks()); + for(k = 0; k < nbUserLandMarks; ++k) { NLMISC::CVector2f mapPos; worldToMap(mapPos, _CurContinent->UserLandMarks[k].Pos); @@ -2520,7 +2522,7 @@ CCtrlButton *CGroupMap::addUserLandMark(const NLMISC::CVector2f &pos, const ucst void CGroupMap::removeUserLandMark(CCtrlButton *button) { if (_CurContinent == NULL) return; - nlassert(_CurContinent->UserLandMarks.size() == _UserLM.size()); + nlassert(_CurContinent->UserLandMarks.size() >= _UserLM.size()); for(uint k = 0; k < _UserLM.size(); ++k) { if (_UserLM[k] == button) @@ -2528,6 +2530,13 @@ void CGroupMap::removeUserLandMark(CCtrlButton *button) delCtrl(_UserLM[k]); _UserLM.erase(_UserLM.begin() + k); _CurContinent->UserLandMarks.erase(_CurContinent->UserLandMarks.begin() + k); + + if (_CurContinent->UserLandMarks.size() > _UserLM.size()) + { + // if user has over the limit landmarks, then rebuild visible markers + updateUserLandMarks(); + } + return; } } @@ -2537,7 +2546,7 @@ void CGroupMap::removeUserLandMark(CCtrlButton *button) void CGroupMap::updateUserLandMark(CCtrlButton *button, const ucstring &newTitle, const CUserLandMark::EUserLandMarkType lmType) { if (_CurContinent == NULL) return; - nlassert(_CurContinent->UserLandMarks.size() == _UserLM.size()); + nlassert(_CurContinent->UserLandMarks.size() >= _UserLM.size()); for(uint k = 0; k < _UserLM.size(); ++k) { if (_UserLM[k] == button) @@ -2557,7 +2566,7 @@ CUserLandMark CGroupMap::getUserLandMark(CCtrlButton *button) const { CUserLandMark ulm; if (_CurContinent == NULL) return ulm; - nlassert(_CurContinent->UserLandMarks.size() == _UserLM.size()); + nlassert(_CurContinent->UserLandMarks.size() >= _UserLM.size()); for(uint k = 0; k < _UserLM.size(); ++k) { if (_UserLM[k] == button) @@ -2569,15 +2578,6 @@ CUserLandMark CGroupMap::getUserLandMark(CCtrlButton *button) const return ulm; } -//============================================================================================================ -void CGroupMap::removeExceedingUserLandMarks(uint maxNumber) -{ - while (_UserLM.size() > maxNumber) - { - removeUserLandMark(_UserLM.back()); - } -} - //============================================================================================================ uint CGroupMap::getNumUserLandMarks() const diff --git a/code/ryzom/client/src/interface_v3/group_map.h b/code/ryzom/client/src/interface_v3/group_map.h index 36ec0452e..a252bae11 100644 --- a/code/ryzom/client/src/interface_v3/group_map.h +++ b/code/ryzom/client/src/interface_v3/group_map.h @@ -171,8 +171,6 @@ public: void targetLandmark(CCtrlButton *lm); // get the world position of a landmark or return vector Null if not found void getLandmarkPosition(const CCtrlButton *lm, NLMISC::CVector2f &worldPos); - // remove some landmarks if there are too many - void removeExceedingUserLandMarks(uint maxNumber); //Remove and re-create UserLandMarks void updateUserLandMarks(); diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index 9db2282fc..98184d715 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -355,7 +355,7 @@ public: case 't': // add text ID formatedResult += paramString; break; - + case 'P': case 'p': // add player name if (ClientCfg.Local) @@ -578,7 +578,7 @@ CInterfaceManager::~CInterfaceManager() // release the database observers releaseServerToLocalAutoCopyObservers(); - + /* removeFlushObserver( interfaceLinkUpdater ); delete interfaceLinkUpdater; @@ -601,7 +601,7 @@ void CInterfaceManager::reset() _NeutralColor = NULL; _WarningColor = NULL; _ErrorColor = NULL; - + } // ------------------------------------------------------------------------------------------------ @@ -744,7 +744,7 @@ void CInterfaceManager::initOutGame() // Init LUA Scripting initLUA(); - if (ClientCfg.SelectCharacter != -1) + if (ClientCfg.SelectCharacter != -1) return; { @@ -836,7 +836,7 @@ void CInterfaceManager::uninitOutGame() initStart = ryzomGetLocalTime (); CWidgetManager::getInstance()->activateMasterGroup ("ui:outgame", false); - + CInterfaceParser *parser = dynamic_cast< CInterfaceParser* >( CWidgetManager::getInstance()->getParser() ); //nlinfo ("%d seconds for activateMasterGroup", (uint32)(ryzomGetLocalTime ()-initStart)/1000); initStart = ryzomGetLocalTime (); @@ -1575,10 +1575,10 @@ void CInterfaceManager::setupOptions() { CWidgetManager *wm = CWidgetManager::getInstance(); wm->setupOptions(); - + // Try to change font if any string sFont = wm->getSystemOption( CWidgetManager::OptionFont ).getValStr(); - + if ((!sFont.empty()) && (Driver != NULL)) resetTextContext(sFont.c_str(), true); // Continue to parse the rest of the interface @@ -1810,8 +1810,7 @@ bool CInterfaceManager::loadConfig (const string &filename) // ------------------------------------------------------------------------------------------------ void CInterfaceManager::CDBLandmarkObs::update(ICDBNode *node) { - uint nbBonusLandmarks = ((CCDBNodeLeaf*)node)->getValue32(); - ContinentMngr.checkNumberOfUserLandmarks( STANDARD_NUM_USER_LANDMARKS + nbBonusLandmarks ); + ContinentMngr.updateUserLandMarks(); } @@ -2326,7 +2325,7 @@ void CInterfaceManager::displaySystemInfo(const ucstring &str, const string &cat // If over popup a string at the bottom of the screen if ((mode == CClientConfig::SSysInfoParam::Over) || (mode == CClientConfig::SSysInfoParam::OverOnly)) InSceneBubbleManager.addMessagePopup(str, color); - else if ( (mode == CClientConfig::SSysInfoParam::Around || mode == CClientConfig::SSysInfoParam::CenterAround) + else if ( (mode == CClientConfig::SSysInfoParam::Around || mode == CClientConfig::SSysInfoParam::CenterAround) && PeopleInterraction.AroundMe.Window) PeopleInterraction.ChatInput.AroundMe.displayMessage(str, color, 2); } @@ -3560,7 +3559,7 @@ void CInterfaceManager::CServerToLocalAutoCopy::init(const std::string &dbPath) if(_ServerCounter) { ICDBNode::CTextId textId; - + // **** Add Observers on all nodes // add the observers when server node change textId = ICDBNode::CTextId( string("SERVER:") + dbPath ); @@ -3737,23 +3736,23 @@ char* CInterfaceManager::getTimestampHuman(const char* format /* "[%H:%M:%S] " * /* * Parse tokens in a chatmessage or emote - * + * * Valid subjects: * $me$ * $t$ * $tt$ * $tm1$..$tm8$ - * + * * Valid parameters: * $.name$ * $.title$ - * $.race$ - * $.guild$ + * $.race$ + * $.guild$ * $.gs(m/f/n)$ * * Default parameter if parameter result is empty: * $./$ - * + * * All \d's in default parameter remove a following character. */ bool CInterfaceManager::parseTokens(ucstring& ucstr) @@ -3771,14 +3770,14 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr) endless_loop_protector++; if (endless_loop_protector > 100) { - break; + break; } // Get the whole token substring first end_pos = str.find(end_token, start_pos + 1); - if ((start_pos == ucstring::npos) || - (end_pos == ucstring::npos) || + if ((start_pos == ucstring::npos) || + (end_pos == ucstring::npos) || (end_pos <= start_pos + 1)) { // Wrong formatting; give up on this one. @@ -3894,7 +3893,7 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr) // Index is the database index (serverIndex() not used for team list) CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp( NLMISC::toString(TEAM_DB_PATH ":%hu:NAME", indexInTeam ), false); if (pNL && pNL->getValueBool() ) - { + { // There is a character corresponding to this index pNL = NLGUI::CDBManager::getInstance()->getDbProp( NLMISC::toString( TEAM_DB_PATH ":%hu:UID", indexInTeam ), false ); if (pNL) From ea5a36b10557d123bcc20e75e5c30cfdbefdd486 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sat, 4 Jan 2014 00:20:05 +0200 Subject: [PATCH 5/5] Remove tooltip debug message from logs --HG-- branch : misc-patches --- code/nel/src/gui/view_pointer.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/code/nel/src/gui/view_pointer.cpp b/code/nel/src/gui/view_pointer.cpp index 493f93044..5777ea848 100644 --- a/code/nel/src/gui/view_pointer.cpp +++ b/code/nel/src/gui/view_pointer.cpp @@ -408,7 +408,6 @@ namespace NLGUI splitString(tooltipInfos, "@", tooltipInfosList); texName = tooltipInfosList[0]; tooltip = tooltipInfosList[1]; - nlinfo(tooltip.c_str()); setString(ucstring(tooltip)); CViewRenderer &rVR = *CViewRenderer::getInstance(); sint32 texId = rVR.getTextureIdFromName (texName);