Skip to content

Commit

Permalink
destroy overlay on new window instead of updating parent (#1039)
Browse files Browse the repository at this point in the history
  • Loading branch information
riku55 authored Nov 12, 2023
1 parent a81c22e commit 2164dcc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
18 changes: 12 additions & 6 deletions src/ui/win32/OverlayWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,15 @@ void OverlayWindow::CreateOverlayWindow(HWND hWnd)

if (m_hOverlayWnd && IsWindow(m_hOverlayWnd))
{
// overlay window exists, just update the parent (if necessary)
// overlay window already exists, destroy before creating a new one
if (m_hWnd != hWnd)
{
m_hWnd = hWnd;
SetParent(m_hOverlayWnd, hWnd);
UpdateOverlayPosition();
DestroyOverlayWindow();
}
else
{
return;
}
return;
}

// overlay window does not exist, create it
Expand Down Expand Up @@ -197,8 +198,13 @@ void OverlayWindow::CreateOverlayWindow()
});
}

void OverlayWindow::DestroyOverlayWindow() noexcept
void OverlayWindow::DestroyOverlayWindow()
{

//clear current popups so they don't interfere with creation of a new overlay
auto& pOverlayManager = ra::services::ServiceLocator::GetMutable<ra::ui::viewmodels::OverlayManager>();
pOverlayManager.ClearPopups();

if (m_hEventHook)
{
UnhookWinEvent(m_hEventHook);
Expand Down
2 changes: 1 addition & 1 deletion src/ui/win32/OverlayWindow.hh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class OverlayWindow
{
public:
void CreateOverlayWindow(HWND hWnd);
void DestroyOverlayWindow() noexcept;
void DestroyOverlayWindow();

void OnOverlayMoved() noexcept;

Expand Down

0 comments on commit 2164dcc

Please sign in to comment.