Fix some stories tooltip edge cases.

This commit is contained in:
John Preston 2023-07-25 10:45:08 +04:00
parent 065eb8e63c
commit 57fc9f71ac
3 changed files with 9 additions and 9 deletions

View file

@ -20,7 +20,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "media/streaming/media_streaming_instance.h" #include "media/streaming/media_streaming_instance.h"
#include "media/streaming/media_streaming_player.h" #include "media/streaming/media_streaming_player.h"
#include "base/event_filter.h" #include "base/event_filter.h"
#include "base/qt/qt_tab_key.h"
#include "lang/lang_keys.h" #include "lang/lang_keys.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "styles/style_layers.h" #include "styles/style_layers.h"
@ -671,8 +670,6 @@ PeerShortInfoBox::PeerShortInfoBox(
) | rpl::start_with_next([=] { ) | rpl::start_with_next([=] {
_cover.setScrollTop(_scroll->scrollTop()); _cover.setScrollTop(_scroll->scrollTop());
}, _cover.lifetime()); }, _cover.lifetime());
base::DisableTabKey(this);
} }
PeerShortInfoBox::~PeerShortInfoBox() = default; PeerShortInfoBox::~PeerShortInfoBox() = default;

View file

@ -803,8 +803,10 @@ void Widget::setupStories() {
Core::App().saveSettingsDelayed(); Core::App().saveSettingsDelayed();
}; };
_stories->setShowTooltip( _stories->setShowTooltip(
Core::App().settings().storiesClickTooltipHiddenValue( rpl::combine(
) | rpl::map(!rpl::mappers::_1), Core::App().settings().storiesClickTooltipHiddenValue(),
shownValue(),
!rpl::mappers::_1 && rpl::mappers::_2),
hideTooltip); hideTooltip);
_storiesContents.fire(Stories::ContentForSession( _storiesContents.fire(Stories::ContentForSession(

View file

@ -951,9 +951,6 @@ void List::updateTooltipGeometry() {
return; return;
} }
const auto collapsed = collapsedGeometryCurrent(); const auto collapsed = collapsedGeometryCurrent();
if (collapsed.geometry.isEmpty()) {
int a = 0;
}
const auto geometry = Ui::MapFrom( const auto geometry = Ui::MapFrom(
window(), window(),
parentWidget(), parentWidget(),
@ -964,8 +961,12 @@ void List::updateTooltipGeometry() {
collapsed.geometry.height())); collapsed.geometry.height()));
const auto weak = QPointer<QWidget>(_tooltip.get()); const auto weak = QPointer<QWidget>(_tooltip.get());
const auto countPosition = [=](QSize size) { const auto countPosition = [=](QSize size) {
const auto left = geometry.x()
+ (geometry.width() - size.width()) / 2;
const auto right = window()->width()
- st::dialogsStoriesTooltip.padding.right();
return QPoint( return QPoint(
geometry.x() + (geometry.width() - size.width()) / 2, std::max(std::min(left, right - size.width()), 0),
geometry.y() + geometry.height()); geometry.y() + geometry.height());
}; };
_tooltip->pointAt(geometry, RectPart::Bottom, countPosition); _tooltip->pointAt(geometry, RectPart::Bottom, countPosition);