mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 07:07:08 +02:00
Fix unintentional stories viewer move-by-mouse-drag.
This commit is contained in:
parent
69b9c63a69
commit
92f2b6dfbf
14 changed files with 45 additions and 1 deletions
Telegram
SourceFiles
history/view/controls
history_view_compose_controls.cpphistory_view_compose_controls.hhistory_view_voice_record_bar.cpphistory_view_voice_record_bar.h
media
|
@ -2962,6 +2962,13 @@ bool ComposeControls::isRecording() const {
|
|||
return _voiceRecordBar->isRecording();
|
||||
}
|
||||
|
||||
bool ComposeControls::isRecordingPressed() const {
|
||||
return !_voiceRecordBar->isRecordingLocked()
|
||||
&& (!_voiceRecordBar->isHidden()
|
||||
|| (_send->type() == Ui::SendButton::Type::Record
|
||||
&& _send->isDown()));
|
||||
}
|
||||
|
||||
rpl::producer<bool> ComposeControls::recordingValue() const {
|
||||
return _recording.value();
|
||||
}
|
||||
|
|
|
@ -216,6 +216,7 @@ public:
|
|||
[[nodiscard]] rpl::producer<bool> lockShowStarts() const;
|
||||
[[nodiscard]] bool isLockPresent() const;
|
||||
[[nodiscard]] bool isRecording() const;
|
||||
[[nodiscard]] bool isRecordingPressed() const;
|
||||
[[nodiscard]] rpl::producer<bool> recordingValue() const;
|
||||
[[nodiscard]] rpl::producer<bool> hasSendTextValue() const;
|
||||
|
||||
|
|
|
@ -1581,6 +1581,10 @@ bool VoiceRecordBar::isRecording() const {
|
|||
return _recording.current();
|
||||
}
|
||||
|
||||
bool VoiceRecordBar::isRecordingLocked() const {
|
||||
return isRecording() && _lock->isLocked();
|
||||
}
|
||||
|
||||
bool VoiceRecordBar::isActive() const {
|
||||
return isRecording() || isListenState();
|
||||
}
|
||||
|
|
|
@ -89,6 +89,7 @@ public:
|
|||
void setStartRecordingFilter(Fn<bool()> &&callback);
|
||||
|
||||
[[nodiscard]] bool isRecording() const;
|
||||
[[nodiscard]] bool isRecordingLocked() const;
|
||||
[[nodiscard]] bool isLockPresent() const;
|
||||
[[nodiscard]] bool isListenState() const;
|
||||
[[nodiscard]] bool isActive() const;
|
||||
|
|
|
@ -1443,6 +1443,11 @@ void Controller::moveFromShown() {
|
|||
}
|
||||
}
|
||||
|
||||
bool Controller::ignoreWindowMove(QPoint position) const {
|
||||
return _replyArea->ignoreWindowMove(position)
|
||||
|| _header->ignoreWindowMove(position);
|
||||
}
|
||||
|
||||
rpl::lifetime &Controller::lifetime() {
|
||||
return _lifetime;
|
||||
}
|
||||
|
|
|
@ -160,6 +160,8 @@ public:
|
|||
void reportRequested();
|
||||
void togglePinnedRequested(bool pinned);
|
||||
|
||||
[[nodiscard]] bool ignoreWindowMove(QPoint position) const;
|
||||
|
||||
[[nodiscard]] rpl::lifetime &lifetime();
|
||||
|
||||
private:
|
||||
|
|
|
@ -542,10 +542,12 @@ void Header::rebuildVolumeControls(
|
|||
: Direction::Vertical);
|
||||
|
||||
slider->setChangeProgressCallback([=](float64 value) {
|
||||
_ignoreWindowMove = true;
|
||||
_controller->changeVolume(value);
|
||||
updateVolumeIcon();
|
||||
});
|
||||
slider->setChangeFinishedCallback([=](float64 value) {
|
||||
_ignoreWindowMove = false;
|
||||
_controller->volumeChangeFinished();
|
||||
});
|
||||
button->setClickedCallback([=] {
|
||||
|
@ -623,6 +625,11 @@ void Header::raise() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
bool Header::ignoreWindowMove(QPoint position) const {
|
||||
return _ignoreWindowMove;
|
||||
}
|
||||
|
||||
void Header::updateDateText() {
|
||||
if (!_date || !_data || !_data->date) {
|
||||
return;
|
||||
|
|
|
@ -54,6 +54,8 @@ public:
|
|||
void show(HeaderData data);
|
||||
void raise();
|
||||
|
||||
[[nodiscard]] bool ignoreWindowMove(QPoint position) const;
|
||||
|
||||
private:
|
||||
void updateDateText();
|
||||
void applyPauseState();
|
||||
|
@ -79,6 +81,7 @@ private:
|
|||
std::unique_ptr<Ui::RpWidget> _privacy;
|
||||
std::optional<HeaderData> _data;
|
||||
base::Timer _dateUpdateTimer;
|
||||
bool _ignoreWindowMove = false;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -677,6 +677,10 @@ rpl::producer<bool> ReplyArea::activeValue() const {
|
|||
) | rpl::distinct_until_changed();
|
||||
}
|
||||
|
||||
bool ReplyArea::ignoreWindowMove(QPoint position) const {
|
||||
return _controls->isRecordingPressed();
|
||||
}
|
||||
|
||||
void ReplyArea::showPremiumToast(not_null<DocumentData*> emoji) {
|
||||
// #TODO stories
|
||||
}
|
||||
|
|
|
@ -67,6 +67,8 @@ public:
|
|||
[[nodiscard]] rpl::producer<bool> activeValue() const;
|
||||
[[nodiscard]] rpl::producer<bool> hasSendTextValue() const;
|
||||
|
||||
[[nodiscard]] bool ignoreWindowMove(QPoint position) const;
|
||||
|
||||
private:
|
||||
class Cant;
|
||||
|
||||
|
|
|
@ -103,6 +103,10 @@ void View::togglePinnedRequested(bool pinned) {
|
|||
_controller->togglePinnedRequested(pinned);
|
||||
}
|
||||
|
||||
bool View::ignoreWindowMove(QPoint position) const {
|
||||
return _controller->ignoreWindowMove(position);
|
||||
}
|
||||
|
||||
SiblingView View::sibling(SiblingType type) const {
|
||||
return _controller->sibling(type);
|
||||
}
|
||||
|
|
|
@ -82,6 +82,8 @@ public:
|
|||
void reportRequested();
|
||||
void togglePinnedRequested(bool pinned);
|
||||
|
||||
[[nodiscard]] bool ignoreWindowMove(QPoint position) const;
|
||||
|
||||
[[nodiscard]] rpl::lifetime &lifetime();
|
||||
|
||||
private:
|
||||
|
|
|
@ -706,6 +706,8 @@ void OverlayWidget::setupWindow() {
|
|||
&& (widgetPoint.y() > st::mediaviewHeaderTop)
|
||||
&& QRect(_x, _y, _w, _h).contains(widgetPoint)) {
|
||||
return Flag::None | Flag(0);
|
||||
} else if (_stories && _stories->ignoreWindowMove(widgetPoint)) {
|
||||
return Flag::None | Flag(0);
|
||||
}
|
||||
return Flag::Move | Flag(0);
|
||||
});
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 048156ecda89b54ea48aafd5b0f97ccffcc922c9
|
||||
Subproject commit ae465109201b30fa61b643d72aaf374265c6a9ed
|
Loading…
Add table
Reference in a new issue