Skip to content

Commit 1a65e9f

Browse files
committed
Do not change window bounds when enabled feature MultipleWindowsPerSession
1 parent 1e2dcbe commit 1a65e9f

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
@@ -45,7 +45,8 @@ Explorerplusplus *Explorerplusplus::Create(App *app, const WindowStorageData *st
4545
Explorerplusplus::Explorerplusplus(App *app, const WindowStorageData *storageData) :
4646
m_id(idCounter++),
4747
m_app(app),
48-
m_hContainer(CreateMainWindow(storageData)),
48+
m_hContainer(CreateMainWindow(storageData,
49+
app->GetFeatureList()->IsEnabled(Feature::MultipleWindowsPerSession))),
4950
m_commandController(this),
5051
m_tabBarBackgroundBrush(CreateSolidBrush(TAB_BAR_DARK_MODE_BACKGROUND_COLOR)),
5152
m_pluginMenuManager(m_hContainer, MENU_PLUGIN_START_ID, MENU_PLUGIN_END_ID),
@@ -98,7 +99,8 @@ Explorerplusplus::~Explorerplusplus()
9899
*m_destroyed = true;
99100
}
100101

101-
HWND Explorerplusplus::CreateMainWindow(const WindowStorageData *storageData)
102+
HWND Explorerplusplus::CreateMainWindow(const WindowStorageData *storageData,
103+
const bool MultipleWindowsPerSession)
102104
{
103105
bool isFirstInstance = IsFirstInstance();
104106
static bool mainWindowClassRegistered = false;
@@ -122,8 +124,12 @@ HWND Explorerplusplus::CreateMainWindow(const WindowStorageData *storageData)
122124
CHECK(res);
123125

124126
placement.showCmd = SW_HIDE;
125-
placement.rcNormalPosition =
126-
storageData && isFirstInstance ? storageData->bounds : GetDefaultMainWindowBounds();
127+
if (MultipleWindowsPerSession)
128+
placement.rcNormalPosition =
129+
storageData ? storageData->bounds : GetDefaultMainWindowBounds();
130+
else
131+
placement.rcNormalPosition =
132+
storageData && isFirstInstance ? storageData->bounds : GetDefaultMainWindowBounds();
127133
SetWindowPlacement(hwnd, &placement);
128134

129135
return hwnd;

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

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

207207
Explorerplusplus(App *app, const WindowStorageData *storageData);
208208

209-
static HWND CreateMainWindow(const WindowStorageData *storageData);
209+
static HWND CreateMainWindow(const WindowStorageData *storageData,
210+
const bool multipleWindowsPerSession);
210211
static bool IsFirstInstance();
211212
static ATOM RegisterMainWindowClass(HINSTANCE instance);
212213
static RECT GetDefaultMainWindowBounds();

0 commit comments

Comments
 (0)