diff --git a/src/MainApplicationWindow.qml b/src/MainApplicationWindow.qml index f6e4b468cc7dac2e12571a5cb43dcf2438142ef9..acaf6bbce6d98664c0cabc6cad8135b0e50c01b7 100644 --- a/src/MainApplicationWindow.qml +++ b/src/MainApplicationWindow.qml @@ -47,12 +47,13 @@ ApplicationWindow { } property ApplicationWindow appWindow : root + property bool isFullscreen: visibility === Window.FullScreen function toggleFullScreen() { - if (visibility !== Window.FullScreen) { - showFullScreen() - } else { + if (isFullscreen) { showNormal() + } else { + showFullScreen() } } diff --git a/src/commoncomponents/DataTransferMessageDelegate.qml b/src/commoncomponents/DataTransferMessageDelegate.qml index 0f35455598cbc3f6862647ebbc3b430591d406a5..daea1bf4ff686602f46b854e5bf52373c1ccae62 100644 --- a/src/commoncomponents/DataTransferMessageDelegate.qml +++ b/src/commoncomponents/DataTransferMessageDelegate.qml @@ -35,6 +35,7 @@ Loader { property bool showTime: false property int seq: MsgSeq.single property string author: Author + property bool changeWindowVisibility: false width: ListView.view ? ListView.view.width : 0 @@ -278,7 +279,7 @@ Loader { settings.fullScreenSupportEnabled: mediaInfo.isVideo settings.javascriptCanOpenWindows: false Component.onCompleted: loadHtml(mediaInfo.html, 'file://') - layer.enabled: parent !== appContainer && !appWindow.isFullScreen + layer.enabled: parent !== appContainer && !appWindow.isFullscreen layer.effect: OpacityMask { maskSource: MessageBubble { out: isOutgoing @@ -288,20 +289,43 @@ Loader { radius: msgRadius } } + + function leaveFullScreen() { + parent = localMediaCompLoader + if (root.changeWindowVisibility) { + root.changeWindowVisibility = false + appWindow.showNormal() + } + } + onFullScreenRequested: function(request) { if (JamiQmlUtils.callIsFullscreen) return - if (request.toggleOn && !appWindow.isFullScreen) { + if (request.toggleOn) { parent = appContainer - appWindow.toggleFullScreen() - } else if (!request.toggleOn && appWindow.isFullScreen) { - parent = localMediaCompLoader - appWindow.toggleFullScreen() + if (!appWindow.isFullscreen) { + root.changeWindowVisibility = true + appWindow.showFullScreen() + } + } else { + leaveFullScreen() } request.accept() } + + Connections { + target: appWindow + + function onVisibilityChanged() { + if (wev.isFullScreen && !appWindow.isFullScreen) { + wev.fullScreenCancelled() + leaveFullScreen() + } + } + } } } + Component { id: animatedImageComp AnimatedImage { diff --git a/src/mainview/MainView.qml b/src/mainview/MainView.qml index 1394fa2341a97d8faa6c1f4fd36df0096dec0417..5792f288225697c202650cc0ae57aa3afa796dc9 100644 --- a/src/mainview/MainView.qml +++ b/src/mainview/MainView.qml @@ -562,7 +562,7 @@ Rectangle { onActivated: { if (JamiQmlUtils.callIsFullscreen) callStackView.toggleFullScreen() - else if (appWindow.isFullScreen) + else if (appWindow.visibility === Window.FullScreen) appWindow.toggleFullScreen() } } diff --git a/src/mainview/components/CallStackView.qml b/src/mainview/components/CallStackView.qml index cce19dc4dfb441dcc723cc5bcca7c752cfec65f9..1f1d927fbcfeadcd0d5e1a83a21c70cb5ec7b75c 100644 --- a/src/mainview/components/CallStackView.qml +++ b/src/mainview/components/CallStackView.qml @@ -26,9 +26,10 @@ import net.jami.Constants 1.1 import "../../commoncomponents" Rectangle { - id: callStackViewWindow + id: root property bool isAudioOnly: false + property bool changeWindowVisibility: false property var sipKeys: [ "1", "2", "3", "A", "4", "5", "6", "B", @@ -116,10 +117,13 @@ Rectangle { // manual toggle here because of our fake fullscreen mode (F11) // TODO: handle and save window states, not just a boolean isFullScreen - if (!appWindow.isFullScreen && !JamiQmlUtils.callIsFullscreen) - appWindow.isFullScreen = true - else if (JamiQmlUtils.callIsFullscreen) - appWindow.isFullScreen = false + if (!appWindow.isFullscreen && !JamiQmlUtils.callIsFullscreen) { + root.changeWindowVisibility = true + appWindow.showFullScreen() + } else if (JamiQmlUtils.callIsFullscreen && root.changeWindowVisibility) { + root.changeWindowVisibility = false + appWindow.showNormal() + } JamiQmlUtils.callIsFullscreen = !JamiQmlUtils.callIsFullscreen callPage.parent = JamiQmlUtils.callIsFullscreen ? @@ -134,7 +138,7 @@ Rectangle { target: JamiQmlUtils function onFullScreenCallEnded() { - if (appWindow.isFullScreen) { + if (appWindow.isFullscreen) { toggleFullScreen() } } @@ -173,7 +177,7 @@ Rectangle { anchors.fill: parent property int stackNumber: CallStackView.OngoingPageStack - isAudioOnly: callStackViewWindow.isAudioOnly + isAudioOnly: root.isAudioOnly visible: callStackMainView.currentItem.stackNumber === stackNumber } @@ -184,7 +188,7 @@ Rectangle { anchors.fill: parent property int stackNumber: CallStackView.InitialPageStack - isAudioOnly: callStackViewWindow.isAudioOnly + isAudioOnly: root.isAudioOnly onCallAccepted: { CallAdapter.acceptACall(responsibleAccountId, responsibleConvUid)