From 4f44b63a4984d4e10f0d292ad4c12bc8fa2c1924 Mon Sep 17 00:00:00 2001
From: Nicolas Werner <nicolas.werner@hotmail.de>
Date: Sun, 13 Mar 2022 20:40:09 +0100
Subject: [PATCH] Fix screen share calls

---
 resources/qml/voip/PlaceCall.qml   | 13 +++++++++----
 resources/qml/voip/ScreenShare.qml | 22 +++++++++-------------
 2 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/resources/qml/voip/PlaceCall.qml b/resources/qml/voip/PlaceCall.qml
index 79fd2fc9c..33ad4cfaf 100644
--- a/resources/qml/voip/PlaceCall.qml
+++ b/resources/qml/voip/PlaceCall.qml
@@ -108,10 +108,15 @@ Popup {
                 text: qsTr("Screen")
                 icon.source: "qrc:/icons/icons/ui/screen-share.svg"
                 onClicked: {
-                    var dialog = screenShareDialog.createObject(timelineRoot);
-                    dialog.open();
-                    timelineRoot.destroyOnClose(dialog);
-                    close();
+                    if (buttonLayout.validateMic()) {
+                        Settings.microphone = micCombo.currentText;
+                        Settings.camera = cameraCombo.currentText;
+
+                        var dialog = screenShareDialog.createObject(timelineRoot);
+                        dialog.open();
+                        timelineRoot.destroyOnClose(dialog);
+                        close();
+                    }
                 }
             }
 
diff --git a/resources/qml/voip/ScreenShare.qml b/resources/qml/voip/ScreenShare.qml
index cf58f3fa3..f27c44855 100644
--- a/resources/qml/voip/ScreenShare.qml
+++ b/resources/qml/voip/ScreenShare.qml
@@ -83,7 +83,7 @@ Popup {
                 id: pipCheckBox
 
                 enabled: CallManager.cameras.length > 0
-                checked: Settings.screenSharePiP
+                checked: CallManager.cameras.length > 0 && Settings.screenSharePiP
                 Layout.alignment: Qt.AlignRight
             }
 
@@ -125,19 +125,15 @@ Popup {
             Button {
                 text: qsTr("Share")
                 icon.source: "qrc:/icons/icons/ui/screen-share.svg"
+
                 onClicked: {
-                    if (buttonLayout.validateMic()) {
-                        Settings.microphone = micCombo.currentText;
-                        if (pipCheckBox.checked)
-                            Settings.camera = cameraCombo.currentText;
-
-                        Settings.screenShareFrameRate = frameRateCombo.currentText;
-                        Settings.screenSharePiP = pipCheckBox.checked;
-                        Settings.screenShareRemoteVideo = remoteVideoCheckBox.checked;
-                        Settings.screenShareHideCursor = hideCursorCheckBox.checked;
-                        CallManager.sendInvite(room.roomId, CallType.SCREEN, windowCombo.currentIndex);
-                        close();
-                    }
+                    Settings.screenShareFrameRate = frameRateCombo.currentText;
+                    Settings.screenSharePiP = pipCheckBox.checked;
+                    Settings.screenShareRemoteVideo = remoteVideoCheckBox.checked;
+                    Settings.screenShareHideCursor = hideCursorCheckBox.checked;
+
+                    CallManager.sendInvite(room.roomId, CallType.SCREEN, windowCombo.currentIndex);
+                    close();
                 }
             }
 
-- 
GitLab