diff --git a/Telegram/BuildWin.bat b/Telegram/BuildWin.bat index 6ad6824113..e0a9d9ac3b 100644 --- a/Telegram/BuildWin.bat +++ b/Telegram/BuildWin.bat @@ -15,7 +15,7 @@ set "AppVersionStrFull=%AppVersionStr%.dev" :devprepared echo. -echo Building version %AppVersionStrFull%.. +echo Building version %AppVersionStrFull% for Windows.. echo. if exist ..\Win32\Deploy\deploy\%AppVersionStrMajor%\%AppVersionStr%\ goto error_exist1 diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp index 4e11ec29a5..54254fefb6 100644 --- a/Telegram/SourceFiles/app.cpp +++ b/Telegram/SourceFiles/app.cpp @@ -752,6 +752,8 @@ namespace App { } } + existing->setMedia(m.has_media() ? (&m.vmedia) : 0); + existing->setViewsCount(m.has_views() ? m.vviews.v : -1); } } diff --git a/Telegram/SourceFiles/gui/contextmenu.cpp b/Telegram/SourceFiles/gui/contextmenu.cpp index 964c4b1b4d..07eb5279a9 100644 --- a/Telegram/SourceFiles/gui/contextmenu.cpp +++ b/Telegram/SourceFiles/gui/contextmenu.cpp @@ -269,4 +269,9 @@ void ContextMenu::popup(const QPoint &p) { ContextMenu::~ContextMenu() { clearActions(); +#if defined Q_OS_LINUX32 || defined Q_OS_LINUX64 + if (App::wnd()) { + App::wnd()->activateWindow(); + } +#endif } diff --git a/Telegram/SourceFiles/main.cpp b/Telegram/SourceFiles/main.cpp index 99c7e7787a..7ac4e739fc 100644 --- a/Telegram/SourceFiles/main.cpp +++ b/Telegram/SourceFiles/main.cpp @@ -25,6 +25,9 @@ int main(int argc, char *argv[]) { #ifdef _NEED_WIN_GENERATE_DUMP _oldWndExceptionFilter = SetUnhandledExceptionFilter(_exceptionFilter); #endif +#ifdef _NEED_LINUX_GENERATE_DUMP + //signal(SIGSEGV, _sigsegvHandler); +#endif InitOpenSSL _init; diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 5ec1a612a8..899fd0f395 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -4131,20 +4131,19 @@ void MainWidget::feedUpdates(const MTPUpdates &updates, uint64 randomId) { feedUpdate(MTP_updateMessageID(d.vid, MTP_long(randomId))); // ignore real date if (peerId) { - HistoryItem *item = App::histItemById(peerToChannel(peerId), d.vid.v); - if (!text.isEmpty()) { - bool hasLinks = d.has_entities() && !d.ventities.c_vector().v.isEmpty(); - if (item && ((hasLinks && !item->hasTextLinks()) || (!hasLinks && item->textHasLinks()))) { - bool was = item->hasTextLinks(); - item->setText(text, d.has_entities() ? linksFromMTP(d.ventities.c_vector().v) : LinksInText()); - item->initDimensions(); - itemResized(item); - if (!was && item->hasTextLinks() && (!item->history()->isChannel() || item->fromChannel())) { - item->history()->addToOverview(item, OverviewLinks); + if (HistoryItem *item = App::histItemById(peerToChannel(peerId), d.vid.v)) { + if (!text.isEmpty()) { + bool hasLinks = d.has_entities() && !d.ventities.c_vector().v.isEmpty(); + if ((hasLinks && !item->hasTextLinks()) || (!hasLinks && item->textHasLinks())) { + item->setText(text, d.has_entities() ? linksFromMTP(d.ventities.c_vector().v) : LinksInText()); + item->initDimensions(); + itemResized(item); + if (item->hasTextLinks() && (!item->history()->isChannel() || item->fromChannel())) { + item->history()->addToOverview(item, OverviewLinks); + } } } - } - if (item) { + item->setMedia(d.has_media() ? (&d.vmedia) : 0); } } diff --git a/Telegram/SourceFiles/mediaview.cpp b/Telegram/SourceFiles/mediaview.cpp index afc01138d8..e0d3811bac 100644 --- a/Telegram/SourceFiles/mediaview.cpp +++ b/Telegram/SourceFiles/mediaview.cpp @@ -134,6 +134,10 @@ _saveMsgStarted(0), _saveMsgOpacity(0) } void MediaView::moveToScreen() { + if (App::wnd() && windowHandle() && App::wnd()->windowHandle() && windowHandle()->screen() != App::wnd()->windowHandle()->screen()) { + windowHandle()->setScreen(App::wnd()->windowHandle()->screen()); + } + QPoint wndCenter(App::wnd()->x() + App::wnd()->width() / 2, App::wnd()->y() + App::wnd()->height() / 2); QRect avail = App::app() ? App::app()->desktop()->screenGeometry(wndCenter) : QDesktopWidget().screenGeometry(wndCenter); if (avail != geometry()) { diff --git a/Telegram/SourceFiles/pspecific_linux.cpp b/Telegram/SourceFiles/pspecific_linux.cpp index cf0ff373c5..68f613bdd6 100644 --- a/Telegram/SourceFiles/pspecific_linux.cpp +++ b/Telegram/SourceFiles/pspecific_linux.cpp @@ -1365,3 +1365,18 @@ bool linuxMoveFile(const char *from, const char *to) { return true; } + +#ifdef _NEED_LINUX_GENERATE_DUMP +void _sigsegvHandler(int sig) { + void *array[50] = {0}; + size_t size; + + // get void*'s for all entries on the stack + size = backtrace(array, 50); + + // print out all the frames to stderr + fprintf(stderr, "Error: signal %d:\n", sig); + backtrace_symbols_fd(array, size, STDERR_FILENO); + exit(1); +} +#endif diff --git a/Telegram/SourceFiles/pspecific_linux.h b/Telegram/SourceFiles/pspecific_linux.h index 3c2c2bd8da..52e0711023 100644 --- a/Telegram/SourceFiles/pspecific_linux.h +++ b/Telegram/SourceFiles/pspecific_linux.h @@ -17,6 +17,9 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org */ #pragma once +#include +#include + inline QString psServerPrefix() { return qsl("/tmp/"); } @@ -110,6 +113,9 @@ private: uint64 _psLastIndicatorUpdate; }; +#ifdef _NEED_LINUX_GENERATE_DUMP +void _sigsegvHandler(int sig); +#endif class PsApplication : public QApplication { Q_OBJECT diff --git a/Telegram/SourceFiles/pspecific_wnd.h b/Telegram/SourceFiles/pspecific_wnd.h index 3cb01cd2c9..98ee2cc40c 100644 --- a/Telegram/SourceFiles/pspecific_wnd.h +++ b/Telegram/SourceFiles/pspecific_wnd.h @@ -113,7 +113,7 @@ private: #ifdef _NEED_WIN_GENERATE_DUMP extern LPTOP_LEVEL_EXCEPTION_FILTER _oldWndExceptionFilter; LONG CALLBACK _exceptionFilter(EXCEPTION_POINTERS* pExceptionPointers); -#endif _NEED_WIN_GENERATE_DUMP +#endif class PsApplication : public QApplication { Q_OBJECT diff --git a/Telegram/SourceFiles/stdafx.h b/Telegram/SourceFiles/stdafx.h index 6a17ea088c..e4e137875c 100644 --- a/Telegram/SourceFiles/stdafx.h +++ b/Telegram/SourceFiles/stdafx.h @@ -44,6 +44,8 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org #if defined Q_OS_WIN #define _NEED_WIN_GENERATE_DUMP +#elif defined Q_OS_LINUX32 || defined Q_OS_LINUX64 +#define _NEED_LINUX_GENERATE_DUMP #endif #include "types.h" diff --git a/Telegram/SourceFiles/structs.cpp b/Telegram/SourceFiles/structs.cpp index 6f2a9d304c..fa7154f5a6 100644 --- a/Telegram/SourceFiles/structs.cpp +++ b/Telegram/SourceFiles/structs.cpp @@ -468,30 +468,30 @@ void PtsWaiter::clearSkippedUpdates() { bool PtsWaiter::updated(ChannelData *channel, int32 pts, int32 count) { if (_requesting || _applySkippedLevel) { return true; - } else if (pts <= _good) { + } else if (pts <= _good && count > 0) { return false; } return check(channel, pts, count); } -bool PtsWaiter::updated(ChannelData *channel, int32 pts, int32 ptsCount, const MTPUpdates &updates) { +bool PtsWaiter::updated(ChannelData *channel, int32 pts, int32 count, const MTPUpdates &updates) { if (_requesting || _applySkippedLevel) { return true; - } else if (pts <= _good) { + } else if (pts <= _good && count > 0) { return false; - } else if (check(channel, pts, ptsCount)) { + } else if (check(channel, pts, count)) { return true; } _updatesQueue.insert(ptsKey(SkippedUpdates), updates); return false; } -bool PtsWaiter::updated(ChannelData *channel, int32 pts, int32 ptsCount, const MTPUpdate &update) { +bool PtsWaiter::updated(ChannelData *channel, int32 pts, int32 count, const MTPUpdate &update) { if (_requesting || _applySkippedLevel) { return true; - } else if (pts <= _good) { + } else if (pts <= _good && count > 0) { return false; - } else if (check(channel, pts, ptsCount)) { + } else if (check(channel, pts, count)) { return true; } _updateQueue.insert(ptsKey(SkippedUpdate), update); diff --git a/Telegram/SourceFiles/window.cpp b/Telegram/SourceFiles/window.cpp index 56e6cb0adb..139f543404 100644 --- a/Telegram/SourceFiles/window.cpp +++ b/Telegram/SourceFiles/window.cpp @@ -855,7 +855,14 @@ void Window::layerHidden() { } void Window::hideMediaview() { - if (_mediaView && !_mediaView->isHidden()) _mediaView->hide(); + if (_mediaView && !_mediaView->isHidden()) { + _mediaView->hide(); +#if defined Q_OS_LINUX32 || defined Q_OS_LINUX64 + if (App::wnd()) { + App::wnd()->activateWindow(); + } +#endif + } } void Window::setInnerFocus() {