@@ -1127,6 +1127,13 @@ void PCSX::GUI::endFrame() {
1127
1127
m_offscreenShaderEditor.configure (this );
1128
1128
m_outputShaderEditor.configure (this );
1129
1129
1130
+ ImGuiID dockspaceId = ImGui::DockSpaceOverViewport (0 , nullptr , ImGuiDockNodeFlags_PassthruCentralNode);
1131
+ ImGuiContext* context = ImGui::GetCurrentContext ();
1132
+ ImGuiDockNode* dockspaceNode = ImGui::DockContextFindNodeByID (context, dockspaceId);
1133
+ if (m_fullWindowRender && !dockspaceNode->IsEmpty ()) {
1134
+ m_fullWindowRender = false ;
1135
+ ImGui::SetNextWindowDockID (dockspaceId);
1136
+ }
1130
1137
if (m_fullWindowRender) {
1131
1138
ImTextureID texture = m_offscreenTextures[m_currentTexture];
1132
1139
const auto basePos = ImGui::GetMainViewport ()->Pos ;
@@ -1152,16 +1159,24 @@ void PCSX::GUI::endFrame() {
1152
1159
} else {
1153
1160
ImGui::SetNextWindowPos (ImVec2 (50 , 50 ), ImGuiCond_FirstUseEver);
1154
1161
ImGui::SetNextWindowSize (ImVec2 (640 , 480 ), ImGuiCond_FirstUseEver);
1155
- bool outputShown = true ;
1162
+ bool outputWindowShown = true ;
1156
1163
if (ImGui::Begin (
1157
- _ (" Output" ), &outputShown ,
1164
+ _ (" Output" ), &outputWindowShown ,
1158
1165
ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoCollapse)) {
1159
- ImVec2 textureSize = ImGui::GetContentRegionAvail ();
1166
+ ImGuiDockNode* outputNode = ImGui::GetWindowDockNode ();
1167
+ if (outputNode && dockspaceNode->OnlyNodeWithWindows == outputNode
1168
+ && (!outputNode->TabBar || outputNode->TabBar ->Tabs .size () == 1 )) {
1169
+ // if output is the only visible window in dockspace, switch to full window render mode automatically
1170
+ outputWindowShown = false ;
1171
+ }
1172
+ ImVec2 contentRegion = ImGui::GetContentRegionAvail ();
1173
+ ImVec2 textureSize = contentRegion;
1160
1174
if ((m_outputWindowSize.x != textureSize.x ) || (m_outputWindowSize.y != textureSize.y )) {
1161
1175
m_outputWindowSize = textureSize;
1162
1176
m_setupScreenSize = true ;
1163
1177
}
1164
1178
ImGuiHelpers::normalizeDimensions (textureSize, renderRatio);
1179
+ ImGui::SetCursorPos (ImGui::GetCursorPos () + (contentRegion - textureSize) * 0 .5f );
1165
1180
ImTextureID texture = m_offscreenTextures[m_currentTexture];
1166
1181
if (g_system->getArgs ().isShadersDisabled ()) {
1167
1182
ImGui::Image (texture, textureSize, ImVec2 (0 , 0 ), ImVec2 (1 , 1 ));
@@ -1170,7 +1185,11 @@ void PCSX::GUI::endFrame() {
1170
1185
}
1171
1186
}
1172
1187
ImGui::End ();
1173
- if (!outputShown) m_fullWindowRender = true ;
1188
+ if (!outputWindowShown) {
1189
+ m_fullWindowRender = true ;
1190
+ // full window render mode can't have anything docked in the dockspace
1191
+ ImGui::DockContextClearNodes (context, dockspaceId, true );
1192
+ }
1174
1193
}
1175
1194
1176
1195
bool showOpenIsoFileDialog = false ;
@@ -1433,6 +1452,8 @@ in Configuration->Emulation, restart PCSX-Redux, then try again.)"));
1433
1452
if (ImGui::BeginMenu (_ (" Rendering" ))) {
1434
1453
if (ImGui::MenuItem (_ (" Full window render" ), nullptr , &m_fullWindowRender)) {
1435
1454
m_setupScreenSize = true ;
1455
+ // full window render mode can't have anything docked in the dockspace
1456
+ ImGui::DockContextClearNodes (context, dockspaceId, true );
1436
1457
}
1437
1458
if (ImGui::MenuItem (_ (" Fullscreen" ), nullptr , &m_fullscreen)) {
1438
1459
setFullscreen (m_fullscreen);
0 commit comments