mirror of
https://github.com/telegramdesktop/tdesktop
synced 2024-12-28 01:23:09 +00:00
Merge branch 'dev' of https://github.com/telegramdesktop/tdesktop into dev_private
This commit is contained in:
commit
d155967149
@ -11300,6 +11300,34 @@ index ca92103..225d85f 100644
|
||||
QPainter p(&m_qImage);
|
||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
const QVector<QRect> rects = region.rects();
|
||||
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
|
||||
index 6bec6b1..f14d6ee 100644
|
||||
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
|
||||
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
|
||||
@@ -422,14 +422,20 @@ void QCocoaIntegration::updateScreens()
|
||||
}
|
||||
siblings << screen;
|
||||
}
|
||||
+
|
||||
+
|
||||
+// Patch: backport crash fix from Qt 5.6.1
|
||||
+ // Set virtual siblings list. All screens in mScreens are siblings, because we ignored the
|
||||
+ // mirrors. Note that some of the screens we update the siblings list for here may be deleted
|
||||
+ // below, but update anyway to keep the to-be-deleted screens out of the siblings list.
|
||||
+ foreach (QCocoaScreen* screen, mScreens)
|
||||
+ screen->setVirtualSiblings(siblings);
|
||||
+
|
||||
// Now the leftovers in remainingScreens are no longer current, so we can delete them.
|
||||
foreach (QCocoaScreen* screen, remainingScreens) {
|
||||
mScreens.removeOne(screen);
|
||||
destroyScreen(screen);
|
||||
}
|
||||
- // All screens in mScreens are siblings, because we ignored the mirrors.
|
||||
- foreach (QCocoaScreen* screen, mScreens)
|
||||
- screen->setVirtualSiblings(siblings);
|
||||
}
|
||||
|
||||
QCocoaScreen *QCocoaIntegration::screenAtIndex(int index)
|
||||
diff --git a/src/plugins/platforms/cocoa/qcocoakeymapper.mm b/src/plugins/platforms/cocoa/qcocoakeymapper.mm
|
||||
index c2d206f..0f9b512 100644
|
||||
--- a/src/plugins/platforms/cocoa/qcocoakeymapper.mm
|
||||
|
@ -2159,7 +2159,7 @@ namespace {
|
||||
::cornersMaskSmall[i] = new QImage(mask[i].convertToFormat(QImage::Format_ARGB32_Premultiplied));
|
||||
::cornersMaskSmall[i]->setDevicePixelRatio(cRetinaFactor());
|
||||
}
|
||||
prepareCorners(WhiteCorners, st::buttonRadius, st::white);
|
||||
prepareCorners(WhiteCorners, st::dateRadius, st::white);
|
||||
prepareCorners(StickerCorners, st::dateRadius, st::msgServiceBg);
|
||||
prepareCorners(StickerSelectedCorners, st::dateRadius, st::msgServiceSelectBg);
|
||||
prepareCorners(SelectedOverlaySmallCorners, st::buttonRadius, st::msgSelectOverlay);
|
||||
|
@ -2833,7 +2833,9 @@ void HistoryItem::setId(MsgId newId) {
|
||||
}
|
||||
|
||||
bool HistoryItem::canEdit(const QDateTime &cur) const {
|
||||
if (id < 0 || date.secsTo(cur) >= Global::EditTimeLimit()) return false;
|
||||
auto messageToMyself = (peerToUser(_history->peer->id) == MTP::authedId());
|
||||
auto messageTooOld = messageToMyself ? false : (date.secsTo(cur) >= Global::EditTimeLimit());
|
||||
if (id < 0 || messageTooOld) return false;
|
||||
|
||||
if (auto msg = toHistoryMessage()) {
|
||||
if (msg->Has<HistoryMessageVia>() || msg->Has<HistoryMessageForwarded>()) return false;
|
||||
@ -2854,7 +2856,7 @@ bool HistoryItem::canEdit(const QDateTime &cur) const {
|
||||
auto channel = _history->peer->asChannel();
|
||||
return (channel->amCreator() || (channel->amEditor() && out()));
|
||||
}
|
||||
return out() || (peerToUser(_history->peer->id) == MTP::authedId());
|
||||
return out() || messageToMyself;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -3772,7 +3772,10 @@ int32 MainWidget::dlgsWidth() const {
|
||||
MainWidget::~MainWidget() {
|
||||
if (App::main() == this) _history->showHistory(0, 0);
|
||||
|
||||
delete _hider;
|
||||
if (HistoryHider *hider = _hider) {
|
||||
_hider = nullptr;
|
||||
delete hider;
|
||||
}
|
||||
MTP::clearGlobalHandlers();
|
||||
|
||||
if (App::wnd()) App::wnd()->noMain(this);
|
||||
|
@ -1984,7 +1984,7 @@ public:
|
||||
|
||||
int64 samples = 0;
|
||||
auto res = readMore(buffer, samples);
|
||||
if (res == ReadResult::Error) {
|
||||
if (res == ReadResult::Error || res == ReadResult::EndOfFile) {
|
||||
break;
|
||||
}
|
||||
if (buffer.isEmpty()) {
|
||||
|
@ -52,7 +52,7 @@ ReaderImplementation::ReadResult FFMpegReaderImplementation::readNextFrame() {
|
||||
if (res == AVERROR_EOF) {
|
||||
clearPacketQueue();
|
||||
if (_mode == Mode::Normal) {
|
||||
return ReadResult::Eof;
|
||||
return ReadResult::EndOfFile;
|
||||
}
|
||||
|
||||
if ((res = avformat_seek_file(_fmtContext, _streamId, std::numeric_limits<int64_t>::min(), 0, std::numeric_limits<int64_t>::max(), 0)) < 0) {
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
enum class ReadResult {
|
||||
Success,
|
||||
Error,
|
||||
Eof,
|
||||
EndOfFile,
|
||||
};
|
||||
// Read frames till current frame will have presentation time > frameMs, systemMs = getms().
|
||||
virtual ReadResult readFramesTill(int64 frameMs, uint64 systemMs) = 0;
|
||||
|
@ -55,7 +55,7 @@ ReaderImplementation::ReadResult QtGifReaderImplementation::readNextFrame() {
|
||||
if (_reader) _frameDelay = _reader->nextImageDelay();
|
||||
if (_framesLeft < 1) {
|
||||
if (_mode == Mode::Normal) {
|
||||
return ReadResult::Eof;
|
||||
return ReadResult::EndOfFile;
|
||||
} else if (!jumpToStart()) {
|
||||
return ReadResult::Error;
|
||||
}
|
||||
|
@ -346,7 +346,7 @@ public:
|
||||
}
|
||||
if (frame() && frame()->original.isNull()) {
|
||||
auto readResult = _implementation->readFramesTill(-1, ms);
|
||||
if (readResult == internal::ReaderImplementation::ReadResult::Eof && _seekPositionMs > 0) {
|
||||
if (readResult == internal::ReaderImplementation::ReadResult::EndOfFile && _seekPositionMs > 0) {
|
||||
// If seek was done to the end: try to read the first frame,
|
||||
// get the frame size and return a black frame with that size.
|
||||
|
||||
@ -414,7 +414,7 @@ public:
|
||||
ProcessResult finishProcess(uint64 ms) {
|
||||
auto frameMs = _seekPositionMs + ms - _animationStarted;
|
||||
auto readResult = _implementation->readFramesTill(frameMs, ms);
|
||||
if (readResult == internal::ReaderImplementation::ReadResult::Eof) {
|
||||
if (readResult == internal::ReaderImplementation::ReadResult::EndOfFile) {
|
||||
stop();
|
||||
_state = State::Finished;
|
||||
return ProcessResult::Finished;
|
||||
|
@ -59,8 +59,8 @@ void Controller::onSeekProgress(float64 progress) {
|
||||
auto positionMs = snap(static_cast<int64>(progress * _lastDurationMs), 0LL, _lastDurationMs);
|
||||
if (_seekPositionMs != positionMs) {
|
||||
_seekPositionMs = positionMs;
|
||||
emit seekProgress(positionMs);
|
||||
refreshTimeTexts();
|
||||
emit seekProgress(positionMs); // This may destroy Controller.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,8 +122,8 @@ void Playback::mouseMoveEvent(QMouseEvent *e) {
|
||||
void Playback::mousePressEvent(QMouseEvent *e) {
|
||||
_mouseDown = true;
|
||||
_downProgress = snap(e->pos().x() / float64(width()), 0., 1.);
|
||||
emit seekProgress(_downProgress);
|
||||
update();
|
||||
emit seekProgress(_downProgress); // This may destroy Playback.
|
||||
}
|
||||
|
||||
void Playback::mouseReleaseEvent(QMouseEvent *e) {
|
||||
|
Loading…
Reference in New Issue
Block a user