bitsdojo_window icon indicating copy to clipboard operation
bitsdojo_window copied to clipboard

OnRestore callback

Open Jamminroot opened this issue 2 years ago • 3 comments

Hello!

I've stumbled upon a problem with using your package and a package for a tray notification. Hiding window with appWindow.hide() hides it just fine, but clicking on a tray icon shows blank window.

I am not this familiar with windows API, but I suspect that it's due to how flutter engine works - it basically just makes initial window visible upon lmb click on tray icon, without triggering a rebuild\redraw on the window message.

I do realize that it might not be directly related to the package, but still wonder if it is possible to handle such a case on the package side?

Jamminroot avatar Jul 27 '21 13:07 Jamminroot

If someone stumbles upon similar issue, that can be solved with adding PostMessage(hwnd, 0x7FFE, 3, 0); where necessary in cpp files. My cases were global hotkeys events in

LRESULT
Win32Window::MessageHandler(HWND hwnd,
                            UINT const message,
                            WPARAM const wparam,
                            LPARAM const lparam) noexcept {

and single instance mutex

int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
                      _In_ wchar_t *command_line, _In_ int show_command) {

Those make sure that upon sending SetForegroundWindow() or any other related events we emit event which is handled by bitsdojo_window package internally. Those values basically mean "Redraw children" in this package.

Jamminroot avatar Aug 04 '21 20:08 Jamminroot

On a second thought, I think having a callback which is invoked upon window state change (or on restore?) would help solve this case, and probably other use cases

Jamminroot avatar Aug 12 '21 19:08 Jamminroot

Yes, this is coming in the next update

bitsdojo avatar Aug 12 '21 19:08 bitsdojo