mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-27 16:59:21 +00:00
Add build option to deactivate/activate screensharing
This commit is contained in:
parent
d7a5f3898b
commit
6c0ff0ada2
14 changed files with 84 additions and 57 deletions
|
|
@ -226,6 +226,7 @@ Also, more configurations are available in the docker-files folder of linphone-s
|
|||
| ENABLE_BUILD_VERBOSE | Enable the build generation to be more verbose | NO |
|
||||
| ENABLE_DAEMON | Enable the linphone daemon interface. | NO |
|
||||
| ENABLE_PQCRYPTO | Enable post quantum ZRTP. | NO |
|
||||
| ENABLE_SCREENSHARING | Enable screen sharing. | YES |
|
||||
| ENABLE_STRICT | Build with strict compilator flags e.g. -Wall -Werror | NO |
|
||||
| ENABLE_TESTS | Build with testing binaries of SDK | NO |
|
||||
| ENABLE_TESTS_COMPONENTS | Build libbctoolbox-tester | NO |
|
||||
|
|
|
|||
|
|
@ -838,7 +838,9 @@ if(WIN32)
|
|||
find_package(OpenLDAP REQUIRED)
|
||||
target_link_libraries(${TARGET_NAME} wsock32 ws2_32 ${OPENLDAP_LIBRARIES})
|
||||
endif()
|
||||
target_link_libraries(${TARGET_NAME} Dwmapi)
|
||||
if(ENABLE_SCREENSHARING)
|
||||
target_link_libraries(${TARGET_NAME} Dwmapi)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT WIN32)
|
||||
|
|
|
|||
|
|
@ -338,7 +338,6 @@ void Camera::activatePreview(){
|
|||
mPreviewCounterMutex.lock();
|
||||
if (++mPreviewCounter == 1) {
|
||||
CoreManager::getInstance()->getCore()->enableVideoPreview(true);
|
||||
CoreManager::getInstance()->getSettingsModel()->setCaptureWindowId();
|
||||
}
|
||||
mPreviewCounterMutex.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@
|
|||
*/
|
||||
|
||||
#include "DesktopToolsLinux.hpp"
|
||||
|
||||
#include "components/core/CoreManager.hpp"
|
||||
#include "components/settings/SettingsModel.hpp"
|
||||
#include "components/videoSource/VideoSourceDescriptorModel.hpp"
|
||||
#include "config.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QRect>
|
||||
#include <QThread>
|
||||
#include <X11/Xlib.h>
|
||||
#include <fcntl.h>
|
||||
|
|
@ -53,6 +53,8 @@ void DesktopTools::setScreenSaverStatus(bool status) {
|
|||
emit screenSaverStatusChanged(mScreenSaverStatus);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SCREENSHARING
|
||||
class T : public QThread {
|
||||
public:
|
||||
Display *mDisplay;
|
||||
|
|
@ -87,7 +89,7 @@ public:
|
|||
&event.xbutton.y_root, &event.xbutton.x, &event.xbutton.y, &event.xbutton.state);
|
||||
auto id = event.xbutton.subwindow;
|
||||
QMetaObject::invokeMethod(CoreManager::getInstance(), [id, this]() mutable {
|
||||
mVideoSourceDescriptorModel->setScreenSharingWindow(reinterpret_cast<void*>(id));
|
||||
mVideoSourceDescriptorModel->setScreenSharingWindow(reinterpret_cast<void *>(id));
|
||||
});
|
||||
endLoop = true;
|
||||
}
|
||||
|
|
@ -98,7 +100,10 @@ public:
|
|||
deleteLater();
|
||||
}
|
||||
};
|
||||
#endif
|
||||
void DesktopTools::getWindowIdFromMouse(VideoSourceDescriptorModel *model) {
|
||||
Q_UNUSED(model)
|
||||
#ifdef ENABLE_SCREENSHARING
|
||||
const char *displayStr = getenv("DISPLAY");
|
||||
if (displayStr == NULL) displayStr = ":0";
|
||||
Display *display = XOpenDisplay(displayStr); // QX11Info::display();
|
||||
|
|
@ -115,13 +120,21 @@ void DesktopTools::getWindowIdFromMouse(VideoSourceDescriptorModel *model) {
|
|||
t->mWindow = RootWindow(display, screen); // QX11Info::appRootWindow(m_x11_screen);
|
||||
t->mParent = this;
|
||||
t->start();
|
||||
#endif
|
||||
}
|
||||
|
||||
uintptr_t DesktopTools::getDisplayIndex(void* screenSharing){
|
||||
return *(uintptr_t*)(&screenSharing);
|
||||
uintptr_t DesktopTools::getDisplayIndex(void *screenSharing) {
|
||||
Q_UNUSED(screenSharing)
|
||||
#ifdef ENABLE_SCREENSHARING
|
||||
return *(uintptr_t *)(&screenSharing);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
QRect DesktopTools::getWindowGeometry(void* screenSharing) {
|
||||
QRect DesktopTools::getWindowGeometry(void *screenSharing) {
|
||||
Q_UNUSED(screenSharing)
|
||||
#ifdef ENABLE_SCREENSHARING
|
||||
const char *displayStr = getenv("DISPLAY");
|
||||
if (displayStr == NULL) displayStr = ":0";
|
||||
Display *display = XOpenDisplay(displayStr);
|
||||
|
|
@ -133,4 +146,7 @@ QRect DesktopTools::getWindowGeometry(void* screenSharing) {
|
|||
XWindowAttributes attributes;
|
||||
XGetWindowAttributes(display, windowId, &attributes);
|
||||
return QRect(attributes.x, attributes.y, attributes.width, attributes.height);
|
||||
#else
|
||||
return QRect();
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
#include "DesktopToolsMacOs.hpp"
|
||||
#include "config.h"
|
||||
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
#import <ScreenCaptureKit/ScreenCaptureKit.h>
|
||||
#include <QDebug>
|
||||
|
|
@ -20,6 +22,8 @@ void DesktopTools::init(){
|
|||
|
||||
|
||||
void *DesktopTools::getDisplay(int screenIndex){
|
||||
Q_UNUSED(screenIndex)
|
||||
#ifdef ENABLE_SCREENSHARING
|
||||
CGDirectDisplayID displays[screenIndex+1];
|
||||
CGDisplayCount displayCount;
|
||||
CGGetOnlineDisplayList(screenIndex+1, displays, &displayCount);
|
||||
|
|
@ -27,9 +31,14 @@ void *DesktopTools::getDisplay(int screenIndex){
|
|||
if(displayCount > screenIndex)
|
||||
display = displays[screenIndex];
|
||||
return reinterpret_cast<void*>(display);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
int DesktopTools::getDisplayIndex(void* screenSharing){
|
||||
Q_UNUSED(screenSharing)
|
||||
#ifdef ENABLE_SCREENSHARING
|
||||
CGDirectDisplayID displayId = *(CGDirectDisplayID*)&screenSharing;
|
||||
int maxDisplayCount = 10;
|
||||
CGDisplayCount displayCount;
|
||||
|
|
@ -42,10 +51,13 @@ int DesktopTools::getDisplayIndex(void* screenSharing){
|
|||
}
|
||||
maxDisplayCount *= 2;
|
||||
}while(displayCount == maxDisplayCount/2);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DesktopTools::getWindowIdFromMouse(VideoSourceDescriptorModel *model) {
|
||||
Q_UNUSED(model)
|
||||
#ifdef ENABLE_SCREENSHARING
|
||||
__block id globalMonitorId;
|
||||
__block id localMonitorId;
|
||||
__block DesktopTools * tools = this;
|
||||
|
|
@ -69,10 +81,13 @@ void DesktopTools::getWindowIdFromMouse(VideoSourceDescriptorModel *model) {
|
|||
emit tools->windowIdSelectionEnded();
|
||||
return nil;
|
||||
}];
|
||||
#endif
|
||||
}
|
||||
|
||||
QRect DesktopTools::getWindowGeometry(void* screenSharing) {
|
||||
Q_UNUSED(screenSharing)
|
||||
QRect result;
|
||||
#ifdef ENABLE_SCREENSHARING
|
||||
CGWindowID windowId = *(CGWindowID*)&screenSharing;
|
||||
CFArrayRef descriptions = CGWindowListCopyWindowInfo(kCGWindowListOptionIncludingWindow, windowId);
|
||||
if(CFArrayGetCount(descriptions) > 0) {
|
||||
|
|
@ -90,5 +105,6 @@ QRect DesktopTools::getWindowGeometry(void* screenSharing) {
|
|||
}else
|
||||
qWarning() << "No description found for Window ID : " << windowId;
|
||||
CFRelease(descriptions);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ void DesktopTools::setScreenSaverStatus(bool status) {
|
|||
emit screenSaverStatusChanged(status);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SCREENSHARING
|
||||
HHOOK hMouseHook;
|
||||
DesktopTools *gTools = nullptr;
|
||||
LRESULT CALLBACK mouseProc(int nCode, WPARAM wParam, LPARAM lParam) {
|
||||
|
|
@ -68,26 +69,37 @@ LRESULT CALLBACK mouseProc(int nCode, WPARAM wParam, LPARAM lParam) {
|
|||
}
|
||||
return CallNextHookEx(hMouseHook, nCode, wParam, lParam);
|
||||
}
|
||||
#endif
|
||||
|
||||
void DesktopTools::getWindowIdFromMouse(VideoSourceDescriptorModel *model) {
|
||||
Q_UNUSED(model)
|
||||
#ifdef ENABLE_SCREENSHARING
|
||||
gTools = this;
|
||||
gTools->mVideoSourceDescriptorModel = model;
|
||||
emit windowIdSelectionStarted();
|
||||
HINSTANCE hInstance = GetModuleHandle(NULL);
|
||||
hMouseHook = SetWindowsHookEx(WH_MOUSE_LL, mouseProc, hInstance, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
uintptr_t DesktopTools::getDisplayIndex(void* screenSharing) {
|
||||
return *(uintptr_t*)(&screenSharing);
|
||||
uintptr_t DesktopTools::getDisplayIndex(void *screenSharing) {
|
||||
Q_UNUSED(screenSharing)
|
||||
#ifdef ENABLE_SCREENSHARING
|
||||
return *(uintptr_t *)(&screenSharing);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
QRect DesktopTools::getWindowGeometry(void* screenSharing) {
|
||||
QRect DesktopTools::getWindowGeometry(void *screenSharing) {
|
||||
Q_UNUSED(screenSharing)
|
||||
QRect result;
|
||||
HWND windowId = *(HWND*)&screenSharing;
|
||||
#ifdef ENABLE_SCREENSHARING
|
||||
HWND windowId = *(HWND *)&screenSharing;
|
||||
RECT area;
|
||||
if (S_OK == DwmGetWindowAttribute(windowId, DWMWA_EXTENDED_FRAME_BOUNDS, &area, sizeof(RECT))) {
|
||||
result = QRect(area.left + 1, area.top, area.right - area.left, area.bottom - area.top);// +1 for border
|
||||
}else
|
||||
qWarning() << "Cannot get attributes from HWND: " << windowId;
|
||||
result = QRect(area.left + 1, area.top, area.right - area.left, area.bottom - area.top); // +1 for border
|
||||
} else qWarning() << "Cannot get attributes from HWND: " << windowId;
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -594,31 +594,12 @@ void SettingsModel::setVideoDevice(const QString &device) {
|
|||
emit videoDeviceChanged(device);
|
||||
}
|
||||
|
||||
void SettingsModel::saveCaptureWindowId(void *windowId) {
|
||||
mCaptureWindowId = windowId;
|
||||
//CoreManager::getInstance()->getCore()->setVideoCaptureWindowId(mCaptureWindowId);
|
||||
emit captureScreenIndexChanged(-1);
|
||||
qDebug() << -1;
|
||||
}
|
||||
|
||||
void SettingsModel::saveCaptureScreenIndex(int index) {
|
||||
mCaptureWindowId = reinterpret_cast<void*>(-index);
|
||||
//CoreManager::getInstance()->getCore()->setVideoCaptureWindowId(mCaptureWindowId);
|
||||
emit captureScreenIndexChanged(index);
|
||||
qDebug() << index;
|
||||
}
|
||||
|
||||
int SettingsModel::getCaptureScreenIndex() {
|
||||
/*
|
||||
int64_t id = (int64_t)CoreManager::getInstance()->getCore()->getVideoCaptureWindowId();
|
||||
if(id <= 0){
|
||||
return -id;
|
||||
}else*/
|
||||
return -1;
|
||||
}
|
||||
|
||||
void SettingsModel::setCaptureWindowId() {
|
||||
//CoreManager::getInstance()->getCore()->setVideoCaptureWindowId(mCaptureWindowId);
|
||||
bool SettingsModel::getIsScreenSharingEnabled() const {
|
||||
#ifdef ENABLE_SCREENSHARING
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -104,9 +104,6 @@ class SettingsModel : public QObject {
|
|||
Q_PROPERTY(QStringList videoDevices READ getVideoDevices NOTIFY videoDevicesChanged)
|
||||
|
||||
Q_PROPERTY(QString videoDevice READ getVideoDevice WRITE setVideoDevice NOTIFY videoDeviceChanged)
|
||||
Q_PROPERTY(
|
||||
int captureScreenIndex READ getCaptureScreenIndex WRITE saveCaptureScreenIndex NOTIFY captureScreenIndexChanged)
|
||||
|
||||
Q_PROPERTY(QString videoPreset READ getVideoPreset WRITE setVideoPreset NOTIFY videoPresetChanged)
|
||||
Q_PROPERTY(int videoFramerate READ getVideoFramerate WRITE setVideoFramerate NOTIFY videoFramerateChanged)
|
||||
|
||||
|
|
@ -168,6 +165,7 @@ class SettingsModel : public QObject {
|
|||
waitRegistrationForCallChanged) // Allow call only if the current proxy has been registered
|
||||
Q_PROPERTY(bool incallScreenshotEnabled READ getIncallScreenshotEnabled WRITE setIncallScreenshotEnabled NOTIFY
|
||||
incallScreenshotEnabledChanged)
|
||||
Q_PROPERTY(bool isScreenSharingEnabled READ getIsScreenSharingEnabled CONSTANT)
|
||||
|
||||
Q_PROPERTY(
|
||||
bool conferenceEnabled READ getConferenceEnabled WRITE setConferenceEnabled NOTIFY conferenceEnabledChanged)
|
||||
|
|
@ -424,10 +422,7 @@ public:
|
|||
QString getVideoDevice() const;
|
||||
void setVideoDevice(const QString &device);
|
||||
|
||||
Q_INVOKABLE void saveCaptureWindowId(void *windowId);
|
||||
Q_INVOKABLE void saveCaptureScreenIndex(int index);
|
||||
Q_INVOKABLE int getCaptureScreenIndex();
|
||||
void setCaptureWindowId();
|
||||
bool getIsScreenSharingEnabled() const;
|
||||
|
||||
QString getVideoPreset() const;
|
||||
void setVideoPreset(const QString &preset);
|
||||
|
|
@ -826,7 +821,6 @@ signals:
|
|||
void videoAvailableChanged();
|
||||
void videoDevicesChanged(const QStringList &devices);
|
||||
void videoDeviceChanged(const QString &device);
|
||||
void captureScreenIndexChanged(int index);
|
||||
|
||||
void videoPresetChanged(const QString &preset);
|
||||
void videoFramerateChanged(int framerate);
|
||||
|
|
|
|||
|
|
@ -39,5 +39,6 @@
|
|||
#cmakedefine ENABLE_APP_WEBVIEW "${ENABLE_APP_WEBVIEW}"
|
||||
#cmakedefine QTKEYCHAIN_TARGET_NAME ${QTKEYCHAIN_TARGET_NAME}
|
||||
#cmakedefine PDF_ENABLED
|
||||
#cmakedefine ENABLE_SCREENSHARING "${ENABLE_SCREENSHARING}"
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ Item {
|
|||
property alias textColor: button.textColor
|
||||
property bool enabled: true
|
||||
property bool showBorder : false
|
||||
property bool interactive: true
|
||||
property alias toggled : button.checked
|
||||
property alias button: button
|
||||
property alias radius: button.radius
|
||||
|
|
@ -106,12 +107,13 @@ Item {
|
|||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
|
||||
hoverEnabled: true
|
||||
hoverEnabled: wrappedButton.interactive
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
onPressed: mouse.accepted = false
|
||||
onPressed: mouse.accepted = !interactive
|
||||
interactive: wrappedButton.interactive
|
||||
}
|
||||
|
||||
height: parent.height
|
||||
|
|
|
|||
|
|
@ -4,8 +4,9 @@ import Common 1.0
|
|||
import Common.Styles 1.0
|
||||
|
||||
Quick.MouseArea {
|
||||
cursorShape: containsMouse
|
||||
property bool interactive: true
|
||||
cursorShape: containsMouse && interactive
|
||||
? Qt.PointingHandCursor
|
||||
: Qt.ArrowCursor
|
||||
hoverEnabled: true
|
||||
hoverEnabled: interactive
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ Rectangle{
|
|||
property bool isMeAdmin: me && me.adminStatus
|
||||
property bool isParticipantsMenu: false
|
||||
property bool isScreenSharingMenu: false
|
||||
property bool screenSharingAvailable: conferenceModel && (!conferenceModel.isScreenSharingEnabled || conferenceModel.isLocalScreenSharingEnabled)
|
||||
property bool screenSharingAvailable: SettingsModel.isScreenSharingEnabled && conferenceModel && (!conferenceModel.isScreenSharingEnabled || conferenceModel.isLocalScreenSharingEnabled)
|
||||
signal close()
|
||||
signal layoutChanging(int layoutMode)
|
||||
|
||||
|
|
|
|||
|
|
@ -256,7 +256,8 @@ Rectangle {
|
|||
// Mode buttons
|
||||
TextButtonB{
|
||||
id: screenSharingButton
|
||||
visible: mainItem.isScreenSharingEnabled
|
||||
visible: mainItem.isScreenSharingEnabled && (SettingsModel.isScreenSharingEnabled || !mainItem.isLocalScreenSharingEnabled)
|
||||
interactive: mainItem.isLocalScreenSharingEnabled
|
||||
Layout.preferredWidth: fitWidth
|
||||
Icon{
|
||||
id: screenSharingIcon
|
||||
|
|
@ -279,7 +280,7 @@ Rectangle {
|
|||
onClicked: if(mainItem.isLocalScreenSharingEnabled) conferenceModel.toggleScreenSharing()
|
||||
}
|
||||
ActionButton{
|
||||
visible: !screenSharingButton.visible && callModel && mainItem.conferenceModel && callModel.videoEnabled
|
||||
visible: SettingsModel.isScreenSharingEnabled && !screenSharingButton.visible && callModel && mainItem.conferenceModel && callModel.videoEnabled
|
||||
isCustom: true
|
||||
backgroundRadius: width/2
|
||||
colorSet: IncallStyle.buttons.screenSharing
|
||||
|
|
|
|||
|
|
@ -227,7 +227,8 @@ Window {
|
|||
// Mode buttons
|
||||
TextButtonB{
|
||||
id: screenSharingButton
|
||||
visible: window.isScreenSharingEnabled
|
||||
visible: window.isScreenSharingEnabled && (SettingsModel.isScreenSharingEnabled || !window.isLocalScreenSharingEnabled)
|
||||
interactive: window.isLocalScreenSharingEnabled
|
||||
Layout.preferredWidth: fitWidth
|
||||
Icon{
|
||||
id: screenSharingIcon
|
||||
|
|
@ -250,7 +251,7 @@ Window {
|
|||
onClicked: if(window.isLocalScreenSharingEnabled) conferenceModel.toggleScreenSharing()
|
||||
}
|
||||
ActionButton{
|
||||
visible: !screenSharingButton.visible && callModel && window.conferenceModel && callModel.videoEnabled
|
||||
visible: SettingsModel.isScreenSharingEnabled && !screenSharingButton.visible && callModel && window.conferenceModel && callModel.videoEnabled
|
||||
isCustom: true
|
||||
backgroundRadius: width/2
|
||||
colorSet: IncallStyle.buttons.screenSharing
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue