Removed capping of console window position and size

* for multi-monitor setup, leaving only minimum size of 640x480.
This commit is contained in:
NovaRain
2023-06-29 21:34:41 +08:00
parent b2e60ba62e
commit 6dee4e1183
3 changed files with 11 additions and 13 deletions
+3 -2
View File
@@ -66,7 +66,7 @@ GraphicsWidth=0
GraphicsHeight=0
;Window position data. Do not modify
;Set to -1 or 0 to reset if the window position is incorrect
;Set to -1 or 0 to reset the window position to the center or top-left corner
WindowData=-1
;Uncomment the option to use a hardware shader (requires DX9 graphics mode)
@@ -890,7 +890,7 @@ AlwaysFindScripts=0
Test_ForceFloats=0
;These options control what output is saved in the debug log (sfall-log.txt)
;Prints messages duing sfall initialization
;Prints messages during sfall initialization
Init=1
;Prints messages relating to hook scripts
Hook=0
@@ -911,6 +911,7 @@ Fixes=1
ConsoleWindow=0b0000
;Console window position and size data. Do not modify
;Clear the data to reset the window position and size
ConsoleWindowData=
;Set the code page for the console window (Default is your system code page)
+7 -10
View File
@@ -47,10 +47,6 @@ BOOL WINAPI ConsoleCtrlHandler(DWORD dwCtrlType) {
}
void ConsoleWindow::loadPosition() {
std::string windowDataStr = IniReader::GetStringDefaultConfig("Debugging", "ConsoleWindowData", "");
std::vector<std::string> windowDataSplit = split(windowDataStr, ',');
if (windowDataSplit.size() < 4) return;
HWND wnd;
if (!tryGetWindow(&wnd)) return;
@@ -61,16 +57,17 @@ void ConsoleWindow::loadPosition() {
dlog_f("Error setting console ctrl handler: 0x%x\n", DL_MAIN, GetLastError());
}
std::string windowDataStr = IniReader::GetStringDefaultConfig("Debugging", "ConsoleWindowData", "");
std::vector<std::string> windowDataSplit = split(windowDataStr, ',');
int windowData[5];
for (size_t i = 0; i < 5; i++) {
windowData[i] = i < windowDataSplit.size() ? atoi(windowDataSplit.at(i).c_str()) : 0;
}
int screenWidth = GetSystemMetrics(SM_CXSCREEN),
screenHeight = GetSystemMetrics(SM_CYSCREEN);
LONG w = min(max(windowData[2], 640), screenWidth),
h = min(max(windowData[3], 480), screenHeight),
x = min(max(windowData[0], -w/2), screenWidth - w/2),
y = min(max(windowData[1], 0), screenHeight - h/2);
LONG w = max(windowData[2], 640),
h = max(windowData[3], 480),
x = windowData[0],
y = windowData[1];
UINT showCmd = windowData[4] != 0 ? windowData[4] : SW_SHOWNORMAL;
dlog_f("Setting console window position: (%d, %d), size: %dx%d, showCmd: %d\n", DL_MAIN, x, y, w, h, showCmd);
+1 -1
View File
@@ -661,7 +661,7 @@ static void PrepareGlobalScriptsList() {
baseName = baseName.substr(0, lastDot); // script name without extension
if (!IsGameScript(baseName.c_str())) {
globalScriptFilesList.push_back(baseName);
globalScriptFilesList.push_back(std::move(baseName));
}
}
fo::func::db_free_file_list(&filenames, 0);