From e38b7cd46504579206499bd9dc3abe87c3d9b9ed Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 17 Jun 2016 15:38:08 +0300 Subject: [PATCH 1/2] Fixed dynamic library loading for Windows XP. Versioned dll removed, loading from combase.dll instead. --- Telegram/SourceFiles/platform/win/windows_dlls.cpp | 7 ++----- Telegram/SourceFiles/pspecific_win.cpp | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Telegram/SourceFiles/platform/win/windows_dlls.cpp b/Telegram/SourceFiles/platform/win/windows_dlls.cpp index ae7bef04e0..048aed9291 100644 --- a/Telegram/SourceFiles/platform/win/windows_dlls.cpp +++ b/Telegram/SourceFiles/platform/win/windows_dlls.cpp @@ -43,7 +43,6 @@ HINSTANCE LibShell32; HINSTANCE LibWtsApi32; HINSTANCE LibPropSys; HINSTANCE LibComBase; -HINSTANCE LibWinRtString; void start() { LibUxTheme = LoadLibrary(L"UXTHEME.DLL"); @@ -66,10 +65,8 @@ void start() { LibComBase = LoadLibrary(L"COMBASE.DLL"); load(LibComBase, "RoGetActivationFactory", RoGetActivationFactory); - - LibWinRtString = LoadLibrary(L"api-ms-win-core-winrt-string-l1-1-0.dll"); - load(LibWinRtString, "WindowsCreateStringReference", WindowsCreateStringReference); - load(LibWinRtString, "WindowsDeleteString", WindowsDeleteString); + load(LibComBase, "WindowsCreateStringReference", WindowsCreateStringReference); + load(LibComBase, "WindowsDeleteString", WindowsDeleteString); } } // namespace Dlls diff --git a/Telegram/SourceFiles/pspecific_win.cpp b/Telegram/SourceFiles/pspecific_win.cpp index e75983310d..effc56d8aa 100644 --- a/Telegram/SourceFiles/pspecific_win.cpp +++ b/Telegram/SourceFiles/pspecific_win.cpp @@ -98,7 +98,7 @@ namespace { _PsInitializer() { Dlls::start(); - useOpenWith = (Dlls::SHAssocEnumHandlers != nullptr) && (SHCreateItemFromParsingName != nullptr); + useOpenWith = (Dlls::SHAssocEnumHandlers != nullptr) && (Dlls::SHCreateItemFromParsingName != nullptr); useOpenAs = (Dlls::SHOpenWithDialog != nullptr) || (Dlls::OpenAs_RunDLL != nullptr); useShellapi = (Dlls::SHQueryUserNotificationState != nullptr); } From 963000386fdcd5b94dc6523501235aa5d5df12ae Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 17 Jun 2016 16:27:21 +0300 Subject: [PATCH 2/2] Fixed crash in BotKeyboard resize. Fixed elided single-line Text layout. --- Telegram/SourceFiles/historywidget.cpp | 58 ++++++------------- Telegram/SourceFiles/historywidget.h | 13 +---- .../SourceFiles/platform/win/windows_dlls.h | 2 - Telegram/SourceFiles/ui/text/text.cpp | 12 +++- 4 files changed, 30 insertions(+), 55 deletions(-) diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 6a30d790c5..9c8b6c3f95 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -2445,21 +2445,6 @@ int BotKeyboard::Style::minButtonWidth(HistoryMessageReplyMarkup::Button::Type t return result; } -void BotKeyboard::resizeEvent(QResizeEvent *e) { - if (!_impl) return; - - updateStyle(); - - _height = _impl->naturalHeight() + st::botKbScroll.deltat + st::botKbScroll.deltab; - if (_maximizeSize) _height = qMax(_height, _maxOuterHeight); - if (height() != _height) { - resize(width(), _height); - return; - } - - _impl->resize(width() - _st->margin - st::botKbScroll.width, _height - (st::botKbScroll.deltat + st::botKbScroll.deltab)); -} - void BotKeyboard::mousePressEvent(QMouseEvent *e) { _lastMousePos = e->globalPos(); updateSelected(); @@ -2529,14 +2514,8 @@ bool BotKeyboard::updateMarkup(HistoryItem *to, bool force) { } } - updateStyle(); - _height = st::botKbScroll.deltat + st::botKbScroll.deltab + (_impl ? _impl->naturalHeight() : 0); - if (_maximizeSize) _height = qMax(_height, _maxOuterHeight); - if (height() != _height) { - resize(width(), _height); - } else { - resizeEvent(nullptr); - } + resizeToWidth(width(), _maxOuterHeight); + return true; } @@ -2548,13 +2527,23 @@ bool BotKeyboard::forceReply() const { return _forceReply; } -void BotKeyboard::resizeToWidth(int width, int maxOuterHeight) { - updateStyle(width); - _height = st::botKbScroll.deltat + st::botKbScroll.deltab + (_impl ? _impl->naturalHeight() : 0); +void BotKeyboard::resizeToWidth(int newWidth, int maxOuterHeight) { _maxOuterHeight = maxOuterHeight; - if (_maximizeSize) _height = qMax(_height, _maxOuterHeight); - resize(width, _height); + updateStyle(newWidth); + _height = st::botKbScroll.deltat + st::botKbScroll.deltab + (_impl ? _impl->naturalHeight() : 0); + if (_maximizeSize) { + accumulate_max(_height, _maxOuterHeight); + } + if (_impl) { + int implWidth = newWidth - _st->margin - st::botKbScroll.width; + int implHeight = _height - (st::botKbScroll.deltat + st::botKbScroll.deltab); + _impl->resize(implWidth, implHeight); + } + QSize newSize(newWidth, _height); + if (newSize != size()) { + resize(newSize); + } } bool BotKeyboard::maximizeSize() const { @@ -2565,10 +2554,10 @@ bool BotKeyboard::singleUse() const { return _singleUse; } -void BotKeyboard::updateStyle(int32 w) { +void BotKeyboard::updateStyle(int newWidth) { if (!_impl) return; - int implWidth = ((w < 0) ? width() : w) - st::botKbButton.margin - st::botKbScroll.width; + int implWidth = newWidth - st::botKbButton.margin - st::botKbScroll.width; _st = _impl->isEnoughSpace(implWidth, st::botKbButton) ? &st::botKbButton : &st::botKbTinyButton; _impl->setStyle(std_::make_unique