- OSX fixes (right camera after coming from native window, disappearing content)

- Fix show() to show the window after it was minimized
This commit is contained in:
Thijs Wenker 2018-07-06 17:50:48 +02:00
parent 3a32472b0b
commit 1b63dfa20a
2 changed files with 34 additions and 3 deletions

View file

@ -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() { function setupPresentationMode() {
if (presentationMode === Desktop.PresentationMode.VIRTUAL) { if (presentationMode === Desktop.PresentationMode.VIRTUAL) {
if (nativeWindow) { if (nativeWindow) {
nativeWindow.setVisible(false); nativeWindow.setVisible(false);
} }
contentHolder.parent = root; updateContentParent();
updateInteractiveWindowPositionForMode(); updateInteractiveWindowPositionForMode();
shown = interactiveWindowVisible; shown = interactiveWindowVisible;
} else if (presentationMode === Desktop.PresentationMode.NATIVE) { } else if (presentationMode === Desktop.PresentationMode.NATIVE) {
shown = false; shown = false;
if (nativeWindow) { if (nativeWindow) {
contentHolder.parent = nativeWindow.contentItem; updateContentParent();
updateInteractiveWindowPositionForMode(); updateInteractiveWindowPositionForMode();
nativeWindow.setVisible(interactiveWindowVisible); nativeWindow.setVisible(interactiveWindowVisible);
} }
@ -111,6 +119,14 @@ Windows.Window {
} }
Component.onCompleted: { Component.onCompleted: {
// Fix for parent loss on OSX:
parent.heightChanged.connect(function() {
updateContentParent();
});
parent.widthChanged.connect(function() {
updateContentParent();
});
x = interactiveWindowPosition.x; x = interactiveWindowPosition.x;
y = interactiveWindowPosition.y; y = interactiveWindowPosition.y;
width = interactiveWindowSize.width; width = interactiveWindowSize.width;
@ -211,7 +227,11 @@ Windows.Window {
if (presentationMode === Desktop.PresentationMode.VIRTUAL) { if (presentationMode === Desktop.PresentationMode.VIRTUAL) {
shown = interactiveWindowVisible; shown = interactiveWindowVisible;
} else if (presentationMode === Desktop.PresentationMode.NATIVE && nativeWindow) { } else if (presentationMode === Desktop.PresentationMode.NATIVE && nativeWindow) {
nativeWindow.setVisible(interactiveWindowVisible); if (!nativeWindow.visible && interactiveWindowVisible) {
nativeWindow.showNormal();
} else {
nativeWindow.setVisible(interactiveWindowVisible);
}
} }
} }

View file

@ -4021,7 +4021,18 @@ void Application::mousePressEvent(QMouseEvent* event) {
return; 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()) { if (hasFocus()) {
#endif
if (_keyboardMouseDevice->isActive()) { if (_keyboardMouseDevice->isActive()) {
_keyboardMouseDevice->mousePressEvent(event); _keyboardMouseDevice->mousePressEvent(event);
} }