mirror of
https://github.com/fadden/ciderpress.git
synced 2025-03-11 07:31:16 +00:00
Properly restore negative window positions
It's okay to have the window off the top/left edge of the primary display, but CiderPress was rejecting the values and reverting to default placement. (for issue #41)
This commit is contained in:
parent
e782a9df6e
commit
6de7cfefc0
18
app/Main.cpp
18
app/Main.cpp
@ -1936,15 +1936,17 @@ void MainWindow::SaveWinPlacement()
|
|||||||
|
|
||||||
void MainWindow::RestoreWinPlacement()
|
void MainWindow::RestoreWinPlacement()
|
||||||
{
|
{
|
||||||
RECT normPos;
|
const int kNoVal = -32000;
|
||||||
normPos.left = gMyApp.GetProfileInt(kMainWinSection, kMainWin_Left, -1);
|
|
||||||
normPos.top = gMyApp.GetProfileInt(kMainWinSection, kMainWin_Top, -1);
|
|
||||||
normPos.right = gMyApp.GetProfileInt(kMainWinSection, kMainWin_Right, -1);
|
|
||||||
normPos.bottom = gMyApp.GetProfileInt(kMainWinSection, kMainWin_Bottom, -1);
|
|
||||||
int cmd = gMyApp.GetProfileInt(kMainWinSection, kMainWin_Cmd, -1);
|
|
||||||
|
|
||||||
if (normPos.left < 0 || normPos.top < 0 || normPos.right < 0 ||
|
RECT normPos;
|
||||||
normPos.bottom < 0 || cmd < 0) {
|
normPos.left = gMyApp.GetProfileInt(kMainWinSection, kMainWin_Left, kNoVal);
|
||||||
|
normPos.top = gMyApp.GetProfileInt(kMainWinSection, kMainWin_Top, kNoVal);
|
||||||
|
normPos.right = gMyApp.GetProfileInt(kMainWinSection, kMainWin_Right, kNoVal);
|
||||||
|
normPos.bottom = gMyApp.GetProfileInt(kMainWinSection, kMainWin_Bottom, kNoVal);
|
||||||
|
int cmd = gMyApp.GetProfileInt(kMainWinSection, kMainWin_Cmd, kNoVal);
|
||||||
|
|
||||||
|
if (normPos.left == kNoVal || normPos.top == kNoVal ||
|
||||||
|
normPos.right == kNoVal || normPos.bottom == kNoVal || cmd == kNoVal) {
|
||||||
LOGI("Previous window placement not found.");
|
LOGI("Previous window placement not found.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user