mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
Windows: Update window style flags when toggling kiosk mode
This is a different approach to the change introduced in
04f87320d5.
Instead of completely recreating the window, we now just update the
window's style flags. This should ensure that window and component focus
are preserved.
This commit is contained in:
parent
52079652d0
commit
a2b2813b93
1 changed files with 16 additions and 4 deletions
|
|
@ -5875,13 +5875,25 @@ void Desktop::setKioskComponent (Component* kioskModeComp, bool enableOrDisable,
|
|||
if (auto* peer = dynamic_cast<HWNDComponentPeer*> (kioskModeComp->getPeer()))
|
||||
{
|
||||
const auto prevFlags = (DWORD) GetWindowLong (peer->getHWND(), GWL_STYLE);
|
||||
const auto nextFlags = peer->computeNativeStyleFlags();
|
||||
const auto nextVisibility = prevFlags & WS_VISIBLE;
|
||||
const auto nextFlags = peer->computeNativeStyleFlags() | nextVisibility;
|
||||
|
||||
if (nextFlags != prevFlags)
|
||||
{
|
||||
const auto styleFlags = peer->getStyleFlags();
|
||||
kioskModeComp->removeFromDesktop();
|
||||
kioskModeComp->addToDesktop (styleFlags);
|
||||
SetWindowLong (peer->getHWND(), GWL_STYLE, nextFlags);
|
||||
|
||||
// After changing the window style flags, the window border visibility may have changed.
|
||||
// Call SetWindowPos with no changes other than SWP_FRAMECHANGED to ensure that
|
||||
// GetWindowInfo returns up-to-date border-size values.
|
||||
static constexpr auto frameChangeOnly = SWP_NOSIZE
|
||||
| SWP_NOMOVE
|
||||
| SWP_NOZORDER
|
||||
| SWP_NOREDRAW
|
||||
| SWP_NOACTIVATE
|
||||
| SWP_FRAMECHANGED
|
||||
| SWP_NOOWNERZORDER
|
||||
| SWP_NOSENDCHANGING;
|
||||
SetWindowPos (peer->getHWND(), nullptr, 0, 0, 0, 0, frameChangeOnly);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue