setAlwaysOnTop leave dropshadow visible

When switching from always to top to normal the drop shadow remains visible.

Select window A which is always on top. Switch to normal. Select a window from another process (for example Explorer). You will see, that the drop shadow is still visible even when you move the Explorer window.

Below code fixes it, but maybe there is a smarter solution.

void NativeDesktopWindow::setAlwaysOnTop (bool isOnTop)
    SetWindowPos ((HWND) nativeHandle,
                  (isOnTop) ? HWND_TOPMOST 
                            : HWND_NOTOPMOST,
                  0, 0, 0, 0,

	// force redraw of dropshadow when switching

Ok, thanks, I’ll add something like that…

I use alwaysOnTop, then bringToTop (or whatever it is called to focus a component), then turn alwaysOnTop off to bring something to the top, like when a user hits Ctrl+T anywhere in windows, it brings my program to the top, I’ve yet to notice any shadow oddities like that, mabye because it does not have time to draw it?

Simply implement a button where you toggle a flag and call setAlwaysOnTop in the button listener. Don’t add any further code.
You will notice, that if you start your window with setAlwaysOnTop(true) and clicking the button, the drop shadown is still visible, when your window is topped by any other (Explorer). If you move the other window, the drop shadow is still drawn :slight_smile: