This commit is contained in:
John Preston 2015-09-29 16:38:19 +03:00
commit d5e5ef2d26
12 changed files with 65 additions and 22 deletions

View File

@ -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

View File

@ -752,6 +752,8 @@ namespace App {
}
}
existing->setMedia(m.has_media() ? (&m.vmedia) : 0);
existing->setViewsCount(m.has_views() ? m.vviews.v : -1);
}
}

View File

@ -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
}

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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()) {

View File

@ -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

View File

@ -17,6 +17,9 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <execinfo.h>
#include <signal.h>
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

View File

@ -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

View File

@ -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"

View File

@ -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);

View File

@ -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() {