2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-05 08:55:59 +00:00

Added shortcut to open chat menu from dialogs, chat info and history.

This commit is contained in:
23rd
2025-01-26 11:02:08 +03:00
committed by John Preston
parent 5f5a2a3ef2
commit 157a928f5a
9 changed files with 54 additions and 4 deletions

View File

@@ -1523,6 +1523,21 @@ void InnerWidget::paintSearchTags(
_searchTags->paint(p, position, context.now, context.paused);
}
void InnerWidget::showPeerMenu() {
if (!_selected) {
return;
}
const auto &padding = st::defaultDialogRow.padding;
const auto pos = QPoint(
width() - padding.right(),
_selected->top() + _selected->height() + padding.bottom());
auto event = QContextMenuEvent(
QContextMenuEvent::Keyboard,
pos,
mapToGlobal(pos));
InnerWidget::contextMenuEvent(&event);
}
void InnerWidget::mouseMoveEvent(QMouseEvent *e) {
if (_chatPreviewTouchGlobal || _touchDragStartGlobal) {
return;
@@ -2835,7 +2850,9 @@ bool InnerWidget::scheduleChatPreview(QPoint positionOverride) {
void InnerWidget::contextMenuEvent(QContextMenuEvent *e) {
_menu = nullptr;
if (e->reason() == QContextMenuEvent::Mouse) {
const auto fromMouse = e->reason() == QContextMenuEvent::Mouse;
if (fromMouse) {
selectByMouse(e->globalPos());
}
@@ -2898,6 +2915,9 @@ void InnerWidget::contextMenuEvent(QContextMenuEvent *e) {
if (_menuRow.key) {
updateDialogRow(base::take(_menuRow));
}
if (!fromMouse) {
return;
}
const auto globalPosition = QCursor::pos();
if (rect().contains(mapFromGlobal(globalPosition))) {
setMouseTracking(true);