mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Removed capping of console window position and size
* for multi-monitor setup, leaving only minimum size of 640x480.
This commit is contained in:
+3
-2
@@ -70,7 +70,7 @@ GraphicsWidth=0
|
|||||||
GraphicsHeight=0
|
GraphicsHeight=0
|
||||||
|
|
||||||
;Window position data. Do not modify
|
;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
|
WindowData=-1
|
||||||
|
|
||||||
;Uncomment the option to use a hardware shader (requires DX9 graphics mode)
|
;Uncomment the option to use a hardware shader (requires DX9 graphics mode)
|
||||||
@@ -888,7 +888,7 @@ AlwaysFindScripts=0
|
|||||||
Test_ForceFloats=0
|
Test_ForceFloats=0
|
||||||
|
|
||||||
;These options control what output is saved in the debug log (sfall-log.txt)
|
;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
|
Init=1
|
||||||
;Prints messages relating to hook scripts
|
;Prints messages relating to hook scripts
|
||||||
Hook=0
|
Hook=0
|
||||||
@@ -909,6 +909,7 @@ Fixes=1
|
|||||||
ConsoleWindow=0b0000
|
ConsoleWindow=0b0000
|
||||||
|
|
||||||
;Console window position and size data. Do not modify
|
;Console window position and size data. Do not modify
|
||||||
|
;Clear the data to reset the window position and size
|
||||||
ConsoleWindowData=
|
ConsoleWindowData=
|
||||||
|
|
||||||
;Set the code page for the console window (Default is your system code page)
|
;Set the code page for the console window (Default is your system code page)
|
||||||
|
|||||||
+7
-10
@@ -53,10 +53,6 @@ BOOL WINAPI ConsoleCtrlHandler(DWORD dwCtrlType) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ConsoleWindow::loadPosition() {
|
void ConsoleWindow::loadPosition() {
|
||||||
auto windowDataStr = IniReader::GetStringDefaultConfig(IniSection, IniPositionKey, "");
|
|
||||||
auto windowDataSplit = split(windowDataStr, ',');
|
|
||||||
if (windowDataSplit.size() < 4) return;
|
|
||||||
|
|
||||||
HWND wnd;
|
HWND wnd;
|
||||||
if (!tryGetWindow(&wnd)) return;
|
if (!tryGetWindow(&wnd)) return;
|
||||||
|
|
||||||
@@ -67,16 +63,17 @@ void ConsoleWindow::loadPosition() {
|
|||||||
dlog_f("Error setting console ctrl handler: 0x%x\n", DL_MAIN, GetLastError());
|
dlog_f("Error setting console ctrl handler: 0x%x\n", DL_MAIN, GetLastError());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto windowDataStr = IniReader::GetStringDefaultConfig(IniSection, IniPositionKey, "");
|
||||||
|
auto windowDataSplit = split(windowDataStr, ',');
|
||||||
|
|
||||||
int windowData[5];
|
int windowData[5];
|
||||||
for (size_t i = 0; i < 5; i++) {
|
for (size_t i = 0; i < 5; i++) {
|
||||||
windowData[i] = i < windowDataSplit.size() ? atoi(windowDataSplit.at(i).c_str()) : 0;
|
windowData[i] = i < windowDataSplit.size() ? atoi(windowDataSplit.at(i).c_str()) : 0;
|
||||||
}
|
}
|
||||||
int screenWidth = GetSystemMetrics(SM_CXSCREEN),
|
LONG w = max(windowData[2], 640),
|
||||||
screenHeight = GetSystemMetrics(SM_CYSCREEN);
|
h = max(windowData[3], 480),
|
||||||
LONG w = min(max(windowData[2], 640), screenWidth),
|
x = windowData[0],
|
||||||
h = min(max(windowData[3], 480), screenHeight),
|
y = windowData[1];
|
||||||
x = min(max(windowData[0], -w/2), screenWidth - w/2),
|
|
||||||
y = min(max(windowData[1], 0), screenHeight - h/2);
|
|
||||||
UINT showCmd = windowData[4] != 0 ? windowData[4] : SW_SHOWNORMAL;
|
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);
|
dlog_f("Setting console window position: (%d, %d), size: %dx%d, showCmd: %d\n", DL_MAIN, x, y, w, h, showCmd);
|
||||||
|
|||||||
Reference in New Issue
Block a user