Skip to content

Commit a403150

Browse files
committed
ChatRoom: allow moving/resizing window via overlay mode
1 parent 808fd55 commit a403150

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

src/overlay/chatroom.cpp

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -133,16 +133,18 @@ class ChatRoom : public OverlayWindow
133133
}
134134
}
135135

136-
// If not active then only show window if there are recent messages
137-
if (!isActive && !hasRecentMessages)
138-
return;
139-
140-
if (Overlay::ChatHideBackground)
141-
ImGui::SetNextWindowBgAlpha(0.f);
142-
else
136+
if (!overlayEnabled)
143137
{
144-
if (!isActive && !hasVeryRecentMessages)
145-
ImGui::SetNextWindowBgAlpha(0.3f);
138+
// If not active then only show window if there are recent messages
139+
if (!isActive && !hasRecentMessages)
140+
return;
141+
if (Overlay::ChatHideBackground)
142+
ImGui::SetNextWindowBgAlpha(0.f);
143+
else
144+
{
145+
if (!isActive && !hasVeryRecentMessages)
146+
ImGui::SetNextWindowBgAlpha(0.3f);
147+
}
146148
}
147149

148150
float screenWidth = float(Game::screen_resolution->x);
@@ -152,14 +154,10 @@ class ChatRoom : public OverlayWindow
152154

153155
float screenQuarterHeight = screenHeight / 4;
154156

155-
ImGui::SetNextWindowPos(ImVec2(borderWidth + 20, (screenQuarterHeight * 3) - 20));
157+
ImGui::SetNextWindowPos(ImVec2(borderWidth + 20, (screenQuarterHeight * 3) - 20), ImGuiCond_FirstUseEver);
156158
ImGui::SetNextWindowSize(ImVec2(contentWidth - 40, screenQuarterHeight), ImGuiCond_FirstUseEver);
157159

158-
if (ImGui::Begin("Chat Messages", nullptr,
159-
ImGuiWindowFlags_NoDecoration |
160-
ImGuiWindowFlags_NoSavedSettings |
161-
ImGuiWindowFlags_NoFocusOnAppearing |
162-
ImGuiWindowFlags_NoNav))
160+
if (ImGui::Begin("Chat Messages", nullptr, !overlayEnabled ? ImGuiWindowFlags_NoDecoration : 0))
163161
{
164162
ImGui::SetWindowFontScale(Overlay::ChatFontSize);
165163
ImGui::BeginChild("ScrollingRegion", ImVec2(0, -ImGui::GetFrameHeightWithSpacing()), false, ImGuiWindowFlags_HorizontalScrollbar);

0 commit comments

Comments
 (0)