mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 11:45:36 +02:00
Fix maximized Windows window unintentionally changing to windowed
This stops a maximized Windows window changing to being windowed when you click on a menu item.
This commit is contained in:
parent
9aa9dac7f3
commit
4fa2b3a6e9
3 changed files with 14 additions and 4 deletions
|
@ -156,18 +156,27 @@ public:
|
|||
bool nativeEventFilter(const QByteArray &eventType, void* msg, long* result) Q_DECL_OVERRIDE {
|
||||
if (eventType == "windows_generic_MSG") {
|
||||
MSG* message = (MSG*)msg;
|
||||
|
||||
if (message->message == UWM_IDENTIFY_INSTANCES) {
|
||||
*result = UWM_IDENTIFY_INSTANCES;
|
||||
return true;
|
||||
}
|
||||
if (message->message == WM_SHOWWINDOW) {
|
||||
Application::getInstance()->getWindow()->showNormal();
|
||||
|
||||
if (message->message == UWM_SHOW_APPLICATION) {
|
||||
MainWindow* applicationWindow = Application::getInstance()->getWindow();
|
||||
if (applicationWindow->isMinimized()) {
|
||||
applicationWindow->showNormal(); // Restores to windowed or maximized state appropriately.
|
||||
}
|
||||
Application::getInstance()->setActiveWindow(applicationWindow); // Flashes the taskbar icon if not focus.
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message->message == WM_COPYDATA) {
|
||||
COPYDATASTRUCT* pcds = (COPYDATASTRUCT*)(message->lParam);
|
||||
QUrl url = QUrl((const char*)(pcds->lpData));
|
||||
if (url.isValid() && url.scheme() == HIFI_URL_SCHEME) {
|
||||
DependencyManager::get<AddressManager>()->handleLookupString(url.toString());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,6 +117,8 @@ static const QString INFO_EDIT_ENTITIES_PATH = "html/edit-entities-commands.html
|
|||
#ifdef Q_OS_WIN
|
||||
static const UINT UWM_IDENTIFY_INSTANCES =
|
||||
RegisterWindowMessage("UWM_IDENTIFY_INSTANCES_{8AB82783-B74A-4258-955B-8188C22AA0D6}");
|
||||
static const UINT UWM_SHOW_APPLICATION =
|
||||
RegisterWindowMessage("UWM_SHOW_APPLICATION_{71123FD6-3DA8-4DC1-9C27-8A12A6250CBA}");
|
||||
#endif
|
||||
|
||||
class Application;
|
||||
|
|
|
@ -46,8 +46,7 @@ int main(int argc, const char * argv[]) {
|
|||
HWND otherInstance = NULL;
|
||||
EnumWindows(enumWindowsCallback, (LPARAM)&otherInstance);
|
||||
if (otherInstance) {
|
||||
ShowWindow(otherInstance, SW_RESTORE);
|
||||
SetForegroundWindow(otherInstance);
|
||||
SendMessage(otherInstance, UWM_SHOW_APPLICATION, 0, 0);
|
||||
|
||||
QUrl url = QUrl(argv[1]);
|
||||
if (url.isValid() && url.scheme() == HIFI_URL_SCHEME) {
|
||||
|
|
Loading…
Reference in a new issue