mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-04-01 14:50:24 +00:00
Some layout fixes, std_::align() fixed to work in OS X 10.6-7 build.
This commit is contained in:
parent
f1f7333c7a
commit
6b8d3aa48c
@ -1007,7 +1007,7 @@ msgInvDblCheckImg: sprite(300px, 65px, 20px, 20px);
|
|||||||
msgInvViewsImg: sprite(104px, 59px, 16px, 11px);
|
msgInvViewsImg: sprite(104px, 59px, 16px, 11px);
|
||||||
msgInvSendingViewsImg: sprite(104px, 114px, 16px, 11px);
|
msgInvSendingViewsImg: sprite(104px, 114px, 16px, 11px);
|
||||||
|
|
||||||
msgDateSpace: 19px;
|
msgDateSpace: 12px;
|
||||||
msgDateCheckSpace: 4px;
|
msgDateCheckSpace: 4px;
|
||||||
msgDateViewsSpace: 11px;
|
msgDateViewsSpace: 11px;
|
||||||
msgDateDelta: point(2px, 5px);
|
msgDateDelta: point(2px, 5px);
|
||||||
|
@ -20,6 +20,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
// we copy some parts of C++11/14/17 std:: library, because on OS X 10.6+
|
// we copy some parts of C++11/14/17 std:: library, because on OS X 10.6+
|
||||||
// version we can use C++11/14/17, but we can not use its library :(
|
// version we can use C++11/14/17, but we can not use its library :(
|
||||||
namespace std_ {
|
namespace std_ {
|
||||||
@ -204,11 +206,13 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
T *release() noexcept {
|
T *release() noexcept {
|
||||||
return getPointerAndReset(_p);
|
auto old = _p;
|
||||||
|
_p = nullptr;
|
||||||
|
return old;
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset(T *p = nullptr) noexcept {
|
void reset(T *p = nullptr) noexcept {
|
||||||
T *old = _p;
|
auto old = _p;
|
||||||
_p = p;
|
_p = p;
|
||||||
if (old) {
|
if (old) {
|
||||||
delete old;
|
delete old;
|
||||||
@ -260,9 +264,12 @@ struct is_base_of {
|
|||||||
static constexpr bool value = sizeof(check(_host<Base, Derived>(), int())) == sizeof(_yes);
|
static constexpr bool value = sizeof(check(_host<Base, Derived>(), int())) == sizeof(_yes);
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef OS_MAC_OLD
|
|
||||||
inline void *align(size_t alignment, size_t size, void*& ptr, size_t& space) noexcept {
|
inline void *align(size_t alignment, size_t size, void*& ptr, size_t& space) noexcept {
|
||||||
auto p = reinterpret_cast<std::uintptr_t>(ptr);
|
#ifndef OS_MAC_OLD
|
||||||
|
using std::uintptr_t;
|
||||||
|
#endif // OS_MAC_OLD
|
||||||
|
|
||||||
|
auto p = reinterpret_cast<uintptr_t>(ptr);
|
||||||
auto a = (p - 1u + alignment) & -alignment;
|
auto a = (p - 1u + alignment) & -alignment;
|
||||||
auto d = a - p;
|
auto d = a - p;
|
||||||
if ((size + d) > space) {
|
if ((size + d) > space) {
|
||||||
@ -271,6 +278,5 @@ inline void *align(size_t alignment, size_t size, void*& ptr, size_t& space) noe
|
|||||||
space -= d;
|
space -= d;
|
||||||
return ptr = reinterpret_cast<void*>(a);
|
return ptr = reinterpret_cast<void*>(a);
|
||||||
}
|
}
|
||||||
#endif // OS_MAC_OLD
|
|
||||||
|
|
||||||
} // namespace std_
|
} // namespace std_
|
||||||
|
@ -2560,7 +2560,7 @@ int HistoryWebPage::resizeGetHeight(int width) {
|
|||||||
return _height;
|
return _height;
|
||||||
}
|
}
|
||||||
|
|
||||||
_width = qMin(width, _maxw);
|
_width = width = qMin(width, _maxw);
|
||||||
width -= st::msgPadding.left() + st::webPageLeft + st::msgPadding.right();
|
width -= st::msgPadding.left() + st::webPageLeft + st::msgPadding.right();
|
||||||
|
|
||||||
int32 linesMax = 5;
|
int32 linesMax = 5;
|
||||||
@ -2659,10 +2659,10 @@ void HistoryWebPage::draw(Painter &p, const QRect &r, TextSelection selection, u
|
|||||||
auto padding = inBubblePadding();
|
auto padding = inBubblePadding();
|
||||||
auto tshift = padding.top();
|
auto tshift = padding.top();
|
||||||
auto bshift = padding.bottom();
|
auto bshift = padding.bottom();
|
||||||
|
width -= padding.left() + padding.right();
|
||||||
if (_asArticle || (isBubbleBottom() && _attach && _attach->customInfoLayout() && _attach->currentWidth() + _parent->skipBlockWidth() > width + bubble.left() + bubble.right())) {
|
if (_asArticle || (isBubbleBottom() && _attach && _attach->customInfoLayout() && _attach->currentWidth() + _parent->skipBlockWidth() > width + bubble.left() + bubble.right())) {
|
||||||
bshift += bottomInfoPadding();
|
bshift += bottomInfoPadding();
|
||||||
}
|
}
|
||||||
width -= padding.left() + padding.right();
|
|
||||||
|
|
||||||
QRect bar(rtlrect(st::msgPadding.left(), tshift, st::webPageBar, _height - tshift - bshift, _width));
|
QRect bar(rtlrect(st::msgPadding.left(), tshift, st::webPageBar, _height - tshift - bshift, _width));
|
||||||
p.fillRect(bar, barfg);
|
p.fillRect(bar, barfg);
|
||||||
@ -2994,7 +2994,7 @@ void HistoryGame::initDimensions() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int HistoryGame::resizeGetHeight(int width) {
|
int HistoryGame::resizeGetHeight(int width) {
|
||||||
_width = qMin(width, _maxw);
|
_width = width = qMin(width, _maxw);
|
||||||
width -= st::msgPadding.left() + st::webPageLeft + st::msgPadding.right();
|
width -= st::msgPadding.left() + st::webPageLeft + st::msgPadding.right();
|
||||||
|
|
||||||
// enable any count of lines in game description / message
|
// enable any count of lines in game description / message
|
||||||
@ -3056,10 +3056,10 @@ void HistoryGame::draw(Painter &p, const QRect &r, TextSelection selection, uint
|
|||||||
auto padding = inBubblePadding();
|
auto padding = inBubblePadding();
|
||||||
auto tshift = padding.top();
|
auto tshift = padding.top();
|
||||||
auto bshift = padding.bottom();
|
auto bshift = padding.bottom();
|
||||||
|
width -= padding.left() + padding.right();
|
||||||
if (isBubbleBottom() && _attach && _attach->customInfoLayout() && _attach->currentWidth() + _parent->skipBlockWidth() > width + bubble.left() + bubble.right()) {
|
if (isBubbleBottom() && _attach && _attach->customInfoLayout() && _attach->currentWidth() + _parent->skipBlockWidth() > width + bubble.left() + bubble.right()) {
|
||||||
bshift += bottomInfoPadding();
|
bshift += bottomInfoPadding();
|
||||||
}
|
}
|
||||||
width -= padding.left() + padding.right();
|
|
||||||
|
|
||||||
QRect bar(rtlrect(st::msgPadding.left(), tshift, st::webPageBar, _height - tshift - bshift, _width));
|
QRect bar(rtlrect(st::msgPadding.left(), tshift, st::webPageBar, _height - tshift - bshift, _width));
|
||||||
p.fillRect(bar, barfg);
|
p.fillRect(bar, barfg);
|
||||||
|
@ -1976,7 +1976,8 @@ bool HistoryService::prepareGameScoreText(const QString &from, QString *outText,
|
|||||||
auto getGameTitle = [item = gamescore->msg, &second]()->QString {
|
auto getGameTitle = [item = gamescore->msg, &second]()->QString {
|
||||||
if (auto media = item->getMedia()) {
|
if (auto media = item->getMedia()) {
|
||||||
if (media->type() == MediaTypeGame) {
|
if (media->type() == MediaTypeGame) {
|
||||||
return static_cast<HistoryGame*>(media)->game()->title;
|
second = MakeShared<ReplyMarkupClickHandler>(item, 0, 0);
|
||||||
|
return textcmdLink(2, static_cast<HistoryGame*>(media)->game()->title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return lang(lng_deleted_message);
|
return lang(lng_deleted_message);
|
||||||
|
Loading…
Reference in New Issue
Block a user