From d367e32a400dba41a394e7e69b6d10a419dd487c Mon Sep 17 00:00:00 2001 From: Nimetu Date: Wed, 24 Jun 2020 13:59:39 +0300 Subject: [PATCH] Fixed: set_desktop handler only worked with keypress event --- .../src/interface_v3/action_handler_game.cpp | 34 ++++++------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/ryzom/client/src/interface_v3/action_handler_game.cpp b/ryzom/client/src/interface_v3/action_handler_game.cpp index 58c00421b..5af8485d6 100644 --- a/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -2822,24 +2822,6 @@ public: virtual void execute (CCtrlBase * /* pCaller */, const string &Params) { - /* // Previous version (multiple pressed on a desktop change a central window - uint desktop; - fromString(Params, desktop); - if (desktop getDbProp(dbNames[desktop], false); - if (pNL != NULL) - sValue = NLMISC::toString((sint32)pNL->getValue64()); - vector vecStr; - vecStr.push_back(procNames[desktop]); - vecStr.push_back(sValue); - CWidgetManager::getInstance()->runProcedure(procNames[desktop], NULL, vecStr); - }*/ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); CGroupContainer *pGC = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:gestion_windows")); if (pGC == NULL) @@ -2850,11 +2832,14 @@ public: CInterfaceElement *pIE = CWidgetManager::getInstance()->getElementFromId("ui:interface:gestion_windows:close"); if (pIE != NULL) pIE->setActive(false); + bool switchDesktop = false; + CActionsManager *pAM = &Actions; if (!pAM->valide(CAction::CName("set_desktop",Params.c_str()))) { pGC->setActive(false); _FirstTime = true; + switchDesktop = true; } else // Key is down { @@ -2862,11 +2847,7 @@ public: if (_FirstTime) { _FirstTime = false; - - vector vecStr; - vecStr.push_back("tb_setdesktop"); - vecStr.push_back(Params); - CWidgetManager::getInstance()->runProcedure("tb_setdesktop", NULL, vecStr); + switchDesktop = true; } else // Not the first time { @@ -2876,6 +2857,13 @@ public: CWidgetManager::getInstance()->setTopWindow(pGC); } } + if (switchDesktop) + { + vector vecStr; + vecStr.push_back("tb_setdesktop"); + vecStr.push_back(Params); + CWidgetManager::getInstance()->runProcedure("tb_setdesktop", NULL, vecStr); + } } private: bool _FirstTime;