Skip to content

Commit

Permalink
win32: make sure to return context back to ourselves when resizing
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <falktx@falktx.com>
  • Loading branch information
falkTX committed Mar 26, 2022
1 parent 1ec670c commit f26b814
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions dgl/src/pugl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,15 @@ START_NAMESPACE_DGL

bool puglBackendEnter(PuglView* const view)
{
return view->backend->enter(view, NULL) == PUGL_SUCCESS;
return view->backend->enter(view, nullptr) == PUGL_SUCCESS;
}

// --------------------------------------------------------------------------------------------------------------------
// expose backend leave

void puglBackendLeave(PuglView* const view)
{
view->backend->leave(view, NULL);
view->backend->leave(view, nullptr);
}

// --------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -397,14 +397,20 @@ PuglStatus puglSetWindowSize(PuglView* const view, const uint width, const uint

AdjustWindowRectEx(&rect, puglWinGetWindowFlags(view), FALSE, puglWinGetWindowExFlags(view));

if (! SetWindowPos(view->impl->hwnd,
HWND_TOP,
rect.left,
rect.top,
rect.right - rect.left,
rect.bottom - rect.top,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER))
return PUGL_UNKNOWN_ERROR;
if (SetWindowPos(view->impl->hwnd,
HWND_TOP,
rect.left,
rect.top,
rect.right - rect.left,
rect.bottom - rect.top,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER))
{
// make sure to return context back to ourselves
view->backend->enter(view, nullptr);
return PUGL_SUCCESS;
}

return PUGL_UNKNOWN_ERROR;
}
#else
// matches upstream pugl, except we use XResizeWindow instead of XMoveResizeWindow
Expand Down

0 comments on commit f26b814

Please sign in to comment.