axmolengine / axmol

Axmol Engine – A Multi-platform Engine for Desktop, XBOX (UWP) and Mobile games. (A fork of Cocos2d-x-4.0)
https://axmol.dev
MIT License
922 stars 205 forks source link

Windows: messageBox should be "always" TOPMOST #2220

Closed aismann closed 2 weeks ago

aismann commented 2 weeks ago

The current implementation of “messageBox(...)” for Windows does not work well:: => No interaction is possible when another window is TOPMOST.

Steps to reproduce:

  1. open on your app a messageBox
  2. if you click outside the messageBox on your app, the messageBox goes behind the app but the input focus is still on the messageBox. => No interaction is possible until the messageBox() becomes TOPMOST again.

FIX: add the TOPMOST flag:

void messageBox(const char* pszMsg, const char* pszTitle)
{
    std::wstring wsMsg   = ntcvt::from_chars(pszMsg);
    std::wstring wsTitle = ntcvt::from_chars(pszTitle);
    MessageBoxW(nullptr, wsMsg.c_str(), wsTitle.c_str(), MB_OK | MB_TOPMOST);
}

I test it on android =>No problem here. wasm =>No problem here.

aismann commented 2 weeks ago

If you want: You can reproduce it when you add messageBox(" ISSUE #2220 ", "Parent Window is blocked"); on line: axmol\tests\cpp-tests\Source\ImGuiTest\ImGuiTest.cpp line 40:

image