diff --git a/Telegram/SourceFiles/boxes/stickers_box.cpp b/Telegram/SourceFiles/boxes/stickers_box.cpp index 5a15a1ec9..0597a8fa2 100644 --- a/Telegram/SourceFiles/boxes/stickers_box.cpp +++ b/Telegram/SourceFiles/boxes/stickers_box.cpp @@ -652,8 +652,8 @@ void StickersBox::prepare() { } if (const auto featured = _featured.widget()) { featured->setInstallSetCallback([=](uint64 setId) { - markAsInstalledCallback(setId); installCallback(setId); + markAsInstalledCallback(setId); }); featured->setRemoveSetCallback(markAsRemovedCallback); } @@ -1905,9 +1905,19 @@ void StickersBox::Inner::updateSelected() { selected = selectedIndex; local.setY(local.y() - _itemsTop - selectedIndex * _rowHeight); const auto row = _rows[selectedIndex].get(); - if (!_megagroupSet && (_isInstalledTab || (_section == Section::Featured) || !row->isInstalled() || row->isArchived() || row->removed)) { + if (!_megagroupSet + && (_isInstalledTab + || (_section == Section::Featured) + || !row->isInstalled() + || row->isArchived() + || row->removed)) { auto removeButton = (_isInstalledTab && !row->removed); - auto rect = myrtlrect(relativeButtonRect(removeButton, false)); + + const auto installedSetButton = !_isInstalledTab + && row->isInstalled() + && !row->isArchived() + && !row->removed; + auto rect = myrtlrect(relativeButtonRect(removeButton, installedSetButton)); actionSel = rect.contains(local) ? selectedIndex : -1; } else { actionSel = -1; @@ -1960,12 +1970,19 @@ void StickersBox::Inner::mouseReleaseEvent(QMouseEvent *e) { _mouse = e->globalPos(); updateSelected(); - if (_actionDown == _actionSel && _actionSel >= 0) { - const auto callback = _rows[_actionDown]->removed - ? _installSetCallback - : _removeSetCallback; + const auto down = _actionDown; + setActionDown(-1); + if (down == _actionSel && _actionSel >= 0) { + const auto row = _rows[down].get(); + const auto installedSet = row->isInstalled() + && !row->isArchived() + && !row->removed; + const auto callback = installedSet + ? _removeSetCallback + : _installSetCallback; if (callback) { - callback(_rows[_actionDown]->set->id); + row->ripple.reset(); + callback(row->set->id); } } else if (_dragging >= 0) { _rows[_dragging]->yadd.start(0.); @@ -1976,7 +1993,7 @@ void StickersBox::Inner::mouseReleaseEvent(QMouseEvent *e) { } _dragging = _started = -1; - } else if (pressed == _selected && _actionSel < 0 && _actionDown < 0) { + } else if (pressed == _selected && _actionSel < 0 && down < 0) { const auto selectedIndex = [&] { if (auto index = std::get_if(&_selected)) { return *index; @@ -2000,7 +2017,6 @@ void StickersBox::Inner::mouseReleaseEvent(QMouseEvent *e) { showSetByRow(*_megagroupSelectedSet); } } - setActionDown(-1); } void StickersBox::Inner::saveGroupSet(Fn done) {