mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
Screen sharing (X11): add hide mouse cursor option
This commit is contained in:
parent
8df10eeeca
commit
3b26cf4ba3
4 changed files with 35 additions and 3 deletions
|
@ -14,6 +14,7 @@ Popup {
|
|||
|
||||
frameRateCombo.currentIndex = frameRateCombo.find(Settings.screenShareFrameRate);
|
||||
remoteVideoCheckBox.checked = Settings.screenShareRemoteVideo;
|
||||
hideCursorCheckBox.checked = Settings.screenShareHideCursor;
|
||||
}
|
||||
palette: colors
|
||||
|
||||
|
@ -55,6 +56,15 @@ Popup {
|
|||
ToolTip.visible: hovered
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
id: hideCursorCheckBox
|
||||
|
||||
Layout.alignment: Qt.AlignLeft
|
||||
Layout.leftMargin: 8
|
||||
Layout.rightMargin: 8
|
||||
text: qsTr("Hide mouse cursor")
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.margins: 8
|
||||
|
||||
|
@ -70,6 +80,7 @@ Popup {
|
|||
Settings.microphone = micCombo.currentText;
|
||||
Settings.screenShareFrameRate = frameRateCombo.currentText;
|
||||
Settings.screenShareRemoteVideo = remoteVideoCheckBox.checked;
|
||||
Settings.screenShareHideCursor = hideCursorCheckBox.checked;
|
||||
CallManager.sendInvite(TimelineManager.timeline.roomId(), CallType.SCREEN);
|
||||
close();
|
||||
}
|
||||
|
|
|
@ -115,6 +115,7 @@ UserSettings::load(std::optional<QString> profile)
|
|||
cameraFrameRate_ = settings.value("user/camera_frame_rate", QString()).toString();
|
||||
screenShareFrameRate_ = settings.value("user/screen_share_frame_rate", 5).toInt();
|
||||
screenShareRemoteVideo_ = settings.value("user/screen_share_remote_video", false).toBool();
|
||||
screenShareHideCursor_ = settings.value("user/screen_share_hide_cursor", false).toBool();
|
||||
useStunServer_ = settings.value("user/use_stun_server", false).toBool();
|
||||
|
||||
if (profile) // set to "" if it's the default to maintain compatibility
|
||||
|
@ -466,6 +467,16 @@ UserSettings::setScreenShareRemoteVideo(bool state)
|
|||
save();
|
||||
}
|
||||
|
||||
void
|
||||
UserSettings::setScreenShareHideCursor(bool state)
|
||||
{
|
||||
if (state == screenShareHideCursor_)
|
||||
return;
|
||||
screenShareHideCursor_ = state;
|
||||
emit screenShareHideCursorChanged(state);
|
||||
save();
|
||||
}
|
||||
|
||||
void
|
||||
UserSettings::setProfile(QString profile)
|
||||
{
|
||||
|
@ -617,6 +628,7 @@ UserSettings::save()
|
|||
settings.setValue("camera_frame_rate", cameraFrameRate_);
|
||||
settings.setValue("screen_share_frame_rate", screenShareFrameRate_);
|
||||
settings.setValue("screen_share_remote_video", screenShareRemoteVideo_);
|
||||
settings.setValue("screen_share_hide_cursor", screenShareHideCursor_);
|
||||
settings.setValue("use_stun_server", useStunServer_);
|
||||
settings.setValue("currentProfile", profile_);
|
||||
|
||||
|
|
|
@ -90,6 +90,8 @@ class UserSettings : public QObject
|
|||
NOTIFY screenShareFrameRateChanged)
|
||||
Q_PROPERTY(bool screenShareRemoteVideo READ screenShareRemoteVideo WRITE
|
||||
setScreenShareRemoteVideo NOTIFY screenShareRemoteVideoChanged)
|
||||
Q_PROPERTY(bool screenShareHideCursor READ screenShareHideCursor WRITE
|
||||
setScreenShareHideCursor NOTIFY screenShareHideCursorChanged)
|
||||
Q_PROPERTY(
|
||||
bool useStunServer READ useStunServer WRITE setUseStunServer NOTIFY useStunServerChanged)
|
||||
Q_PROPERTY(bool shareKeysWithTrustedUsers READ shareKeysWithTrustedUsers WRITE
|
||||
|
@ -149,6 +151,7 @@ public:
|
|||
void setCameraFrameRate(QString frameRate);
|
||||
void setScreenShareFrameRate(int frameRate);
|
||||
void setScreenShareRemoteVideo(bool state);
|
||||
void setScreenShareHideCursor(bool state);
|
||||
void setUseStunServer(bool state);
|
||||
void setShareKeysWithTrustedUsers(bool state);
|
||||
void setProfile(QString profile);
|
||||
|
@ -199,6 +202,7 @@ public:
|
|||
QString cameraFrameRate() const { return cameraFrameRate_; }
|
||||
int screenShareFrameRate() const { return screenShareFrameRate_; }
|
||||
bool screenShareRemoteVideo() const { return screenShareRemoteVideo_; }
|
||||
bool screenShareHideCursor() const { return screenShareHideCursor_; }
|
||||
bool useStunServer() const { return useStunServer_; }
|
||||
bool shareKeysWithTrustedUsers() const { return shareKeysWithTrustedUsers_; }
|
||||
QString profile() const { return profile_; }
|
||||
|
@ -239,6 +243,7 @@ signals:
|
|||
void cameraFrameRateChanged(QString frameRate);
|
||||
void screenShareFrameRateChanged(int frameRate);
|
||||
void screenShareRemoteVideoChanged(bool state);
|
||||
void screenShareHideCursorChanged(bool state);
|
||||
void useStunServerChanged(bool state);
|
||||
void shareKeysWithTrustedUsersChanged(bool state);
|
||||
void profileChanged(QString profile);
|
||||
|
@ -284,6 +289,7 @@ private:
|
|||
QString cameraFrameRate_;
|
||||
int screenShareFrameRate_;
|
||||
bool screenShareRemoteVideo_;
|
||||
bool screenShareHideCursor_;
|
||||
bool useStunServer_;
|
||||
QString profile_;
|
||||
QString userId_;
|
||||
|
|
|
@ -918,10 +918,13 @@ WebRTCSession::addVideoPipeline(int vp8PayloadType)
|
|||
nhlog::ui()->error("WebRTC: failed to create ximagesrc");
|
||||
return false;
|
||||
}
|
||||
g_object_set(source, "use-damage", 0, nullptr);
|
||||
g_object_set(source, "use-damage", FALSE, nullptr);
|
||||
g_object_set(source, "xid", 0, nullptr);
|
||||
|
||||
int frameRate = ChatPage::instance()->userSettings()->screenShareFrameRate();
|
||||
auto settings = ChatPage::instance()->userSettings();
|
||||
g_object_set(source, "show-pointer", !settings->screenShareHideCursor(), nullptr);
|
||||
nhlog::ui()->debug("WebRTC: screen share hide mouse cursor: {}",
|
||||
settings->screenShareHideCursor());
|
||||
int frameRate = settings->screenShareFrameRate();
|
||||
caps = gst_caps_new_simple(
|
||||
"video/x-raw", "framerate", GST_TYPE_FRACTION, frameRate, 1, nullptr);
|
||||
nhlog::ui()->debug("WebRTC: screen share frame rate: {} fps", frameRate);
|
||||
|
|
Loading…
Reference in a new issue