Skip to content

Commit 6cfa47b

Browse files
committed
Do not change window bounds when enabled feature MultipleWindowsPerSession
# Conflicts: # Explorer++/Explorer++/Explorer++.cpp
1 parent 6e60c30 commit 6cfa47b

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

Explorer++/Explorer++/Explorer++.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ Explorerplusplus *Explorerplusplus::Create(App *app, const WindowStorageData *st
4343
Explorerplusplus::Explorerplusplus(App *app, const WindowStorageData *storageData) :
4444
m_id(idCounter++),
4545
m_app(app),
46-
m_hContainer(CreateMainWindow(storageData)),
46+
m_hContainer(CreateMainWindow(storageData,
47+
app->GetFeatureList()->IsEnabled(Feature::MultipleWindowsPerSession))),
4748
m_commandController(this),
4849
m_tabBarBackgroundBrush(CreateSolidBrush(TAB_BAR_DARK_MODE_BACKGROUND_COLOR)),
4950
m_pluginMenuManager(m_hContainer, MENU_PLUGIN_START_ID, MENU_PLUGIN_END_ID),
@@ -95,7 +96,8 @@ Explorerplusplus::~Explorerplusplus()
9596
m_pDirMon->Release();
9697
}
9798

98-
HWND Explorerplusplus::CreateMainWindow(const WindowStorageData *storageData)
99+
HWND Explorerplusplus::CreateMainWindow(const WindowStorageData *storageData,
100+
const bool multipleWindowsPerSession)
99101
{
100102
bool isFirstInstance = IsFirstInstance();
101103
static bool mainWindowClassRegistered = false;
@@ -119,8 +121,12 @@ HWND Explorerplusplus::CreateMainWindow(const WindowStorageData *storageData)
119121
CHECK(res);
120122

121123
placement.showCmd = SW_HIDE;
122-
placement.rcNormalPosition =
123-
storageData && isFirstInstance ? storageData->bounds : LayoutDefaults::GetDefaultMainWindowBounds();
124+
if (multipleWindowsPerSession)
125+
placement.rcNormalPosition =
126+
storageData ? storageData->bounds : LayoutDefaults::GetDefaultMainWindowBounds();
127+
else
128+
placement.rcNormalPosition =
129+
storageData && isFirstInstance ? storageData->bounds : LayoutDefaults::GetDefaultMainWindowBounds();
124130
SetWindowPlacement(hwnd, &placement);
125131

126132
return hwnd;

Explorer++/Explorer++/Explorer++.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,8 @@ class Explorerplusplus :
210210

211211
Explorerplusplus(App *app, const WindowStorageData *storageData);
212212

213-
static HWND CreateMainWindow(const WindowStorageData *storageData);
213+
static HWND CreateMainWindow(const WindowStorageData *storageData,
214+
const bool multipleWindowsPerSession);
214215
static bool IsFirstInstance();
215216
static ATOM RegisterMainWindowClass(HINSTANCE instance);
216217

0 commit comments

Comments
 (0)