Ticket #3870: textinputfix.patch
File textinputfix.patch, 4.3 KB (added by , 7 years ago) |
---|
-
source/ps/GameSetup/GameSetup.cpp
487 487 488 488 const size_t cacheSize = ChooseCacheSize(); 489 489 g_VFS = CreateVfs(cacheSize); 490 490 491 491 const OsPath readonlyConfig = paths.RData()/"config"/""; 492 492 g_VFS->Mount(L"config/", readonlyConfig); 493 493 … … 576 576 in_add_handler(gui_handler); 577 577 578 578 in_add_handler(touch_input_handler); 579 579 580 580 in_add_handler(cinema_manager_handler); 581 581 582 582 // must be registered after (called before) the GUI which relies on these globals … … 589 589 SAFE_DELETE(g_GUI); 590 590 591 591 UnloadHotkeys(); 592 592 593 593 // disable the special Windows cursor, or free textures for OGL cursors 594 594 cursor_draw(g_VFS, 0, g_mouse_x, g_yres-g_mouse_y, false); 595 595 } … … 625 625 g_ConfigDB.SetValueBool(CFG_SYSTEM, "waterrefraction", g_WaterRefraction); 626 626 g_Renderer.SetOptionBool(CRenderer::OPT_SHADOWSONWATER, g_WaterShadows); 627 627 g_ConfigDB.SetValueBool(CFG_SYSTEM, "watershadows", g_WaterShadows); 628 628 629 629 g_Renderer.SetRenderPath(CRenderer::GetRenderPathByName(g_RenderPath)); 630 630 g_Renderer.SetOptionBool(CRenderer::OPT_SHADOWPCF, g_ShadowPCF); 631 631 g_ConfigDB.SetValueBool(CFG_SYSTEM, "shadowpcf", g_ShadowPCF); … … 684 684 } 685 685 atexit(SDL_Quit); 686 686 687 // Text input is active by default, disable it until it is actually needed. 688 SDL_StopTextInput(); 689 687 690 #if OS_MACOSX 688 691 // Some Mac mice only have one button, so they can't right-click 689 692 // but SDL2 can emulate that with Ctrl+Click … … 932 935 933 936 // g_ConfigDB, command line args, globals 934 937 CONFIG_Init(args); 935 936 // Using a global object for the runtime is a workaround until Simulation and AI use 938 939 // Using a global object for the runtime is a workaround until Simulation and AI use 937 940 // their own threads and also their own runtimes. 938 941 const int runtimeSize = 384 * 1024 * 1024; 939 942 const int heapGrowthBytesGCTrigger = 20 * 1024 * 1024; … … 1208 1211 * Examples: 1209 1212 * 1) "Bob" will host a 2 player game on the Arcadia map: 1210 1213 * -autostart="scenarios/Arcadia 02" -autostart-host -autostart-host-players=2 -autostart-playername="Bob" 1211 * 1214 * 1212 1215 * 2) Load Alpine Lakes random map with random seed, 2 players (Athens and Britons), and player 2 is PetraBot: 1213 1216 * -autostart="random/alpine_lakes" -autostart-seed=-1 -autostart-players=2 -autostart-civ=1:athen -autostart-civ=2:brit -autostart-ai=2:petra 1214 1217 */ … … 1255 1258 else 1256 1259 seed = seedArg.ToULong(); 1257 1260 } 1258 1261 1259 1262 // Random map definition will be loaded from JSON file, so we need to parse it 1260 1263 std::wstring scriptPath = L"maps/" + autoStartName.FromUTF8() + L".json"; 1261 1264 JS::RootedValue scriptData(cx); … … 1313 1316 // partially configured 1314 1317 CStr8 mapSettingsJSON = LoadSettingsOfScenarioMap("maps/" + autoStartName + ".xml"); 1315 1318 scriptInterface.ParseJSON(mapSettingsJSON, &settings); 1316 1319 1317 1320 // Initialize the playerData array being modified by autostart 1318 1321 // with the real map data, so sensible values are present: 1319 1322 scriptInterface.GetProperty(settings, "PlayerData", &playerData); … … 1358 1361 std::vector<CStr> civArgs = args.GetMultiple("autostart-team"); 1359 1362 for (size_t i = 0; i < civArgs.size(); ++i) 1360 1363 { 1361 int playerID = civArgs[i].BeforeFirst(":").ToInt(); 1364 int playerID = civArgs[i].BeforeFirst(":").ToInt(); 1362 1365 1363 1366 // Instead of overwriting existing player data, modify the array 1364 1367 JS::RootedValue player(cx); … … 1426 1429 scriptInterface.Eval("({})", &player); 1427 1430 } 1428 1431 1429 int difficulty = civArgs[i].AfterFirst(":").ToInt(); 1432 int difficulty = civArgs[i].AfterFirst(":").ToInt(); 1430 1433 scriptInterface.SetProperty(player, "AIDiff", difficulty); 1431 1434 scriptInterface.SetPropertyInt(playerData, playerID-offset, player); 1432 1435 } … … 1453 1456 } 1454 1457 scriptInterface.Eval("({})", &player); 1455 1458 } 1456 1459 1457 1460 CStr name = civArgs[i].AfterFirst(":"); 1458 1461 scriptInterface.SetProperty(player, "Civ", std::string(name)); 1459 1462 scriptInterface.SetPropertyInt(playerData, playerID-offset, player); … … 1554 1557 shared_ptr<ScriptInterface> pScriptInterface = g_GUI->GetActiveGUI()->GetScriptInterface(); 1555 1558 JSContext* cx = pScriptInterface->GetContext(); 1556 1559 JSAutoRequest rq(cx); 1557 1560 1558 1561 JS::RootedValue global(cx, pScriptInterface->GetGlobalObject()); 1559 1562 // Cancel loader 1560 1563 LDR_Cancel();