diff --git a/interface/resources/qml/InteractiveWindow.qml b/interface/resources/qml/InteractiveWindow.qml index 9c4e10975e..e0290ec5c1 100644 --- a/interface/resources/qml/InteractiveWindow.qml +++ b/interface/resources/qml/InteractiveWindow.qml @@ -90,18 +90,26 @@ Windows.Window { } } + function updateContentParent() { + if (presentationMode === Desktop.PresentationMode.VIRTUAL) { + contentHolder.parent = root; + } else if (presentationMode === Desktop.PresentationMode.NATIVE && nativeWindow) { + contentHolder.parent = nativeWindow.contentItem; + } + } + function setupPresentationMode() { if (presentationMode === Desktop.PresentationMode.VIRTUAL) { if (nativeWindow) { nativeWindow.setVisible(false); } - contentHolder.parent = root; + updateContentParent(); updateInteractiveWindowPositionForMode(); shown = interactiveWindowVisible; } else if (presentationMode === Desktop.PresentationMode.NATIVE) { shown = false; if (nativeWindow) { - contentHolder.parent = nativeWindow.contentItem; + updateContentParent(); updateInteractiveWindowPositionForMode(); nativeWindow.setVisible(interactiveWindowVisible); } @@ -111,6 +119,14 @@ Windows.Window { } Component.onCompleted: { + // Fix for parent loss on OSX: + parent.heightChanged.connect(function() { + updateContentParent(); + }); + parent.widthChanged.connect(function() { + updateContentParent(); + }); + x = interactiveWindowPosition.x; y = interactiveWindowPosition.y; width = interactiveWindowSize.width; @@ -211,7 +227,11 @@ Windows.Window { if (presentationMode === Desktop.PresentationMode.VIRTUAL) { shown = interactiveWindowVisible; } else if (presentationMode === Desktop.PresentationMode.NATIVE && nativeWindow) { - nativeWindow.setVisible(interactiveWindowVisible); + if (!nativeWindow.visible && interactiveWindowVisible) { + nativeWindow.showNormal(); + } else { + nativeWindow.setVisible(interactiveWindowVisible); + } } } diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 92300df406..5decbd2e60 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -4021,7 +4021,18 @@ void Application::mousePressEvent(QMouseEvent* event) { return; } +#if defined(Q_OS_MAC) + // Fix for OSX right click dragging on window when coming from a native window + bool isFocussed = hasFocus(); + if (!isFocussed && event->button() == Qt::MouseButton::RightButton) { + setFocus(); + isFocussed = true; + } + + if (isFocussed) { +#else if (hasFocus()) { +#endif if (_keyboardMouseDevice->isActive()) { _keyboardMouseDevice->mousePressEvent(event); }