mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-19 06:26:55 +00:00
Fix reply from notifications (Qt 5.6.2 broke it).
Now the mouse press on Qt::BypassWindowManagerHint window doesn't activate it. So if you want a working input field in a Qt::BypassWindowManagerHint window, you should activate it yourself from any mouse press event.
This commit is contained in:
parent
3503be03c9
commit
2ffc0196dd
@ -1185,14 +1185,7 @@ void MediaView::displayPhoto(PhotoData *photo, HistoryItem *item) {
|
||||
_from = _user;
|
||||
}
|
||||
_photo->download();
|
||||
updateControls();
|
||||
if (isHidden()) {
|
||||
psUpdateOverlayed(this);
|
||||
show();
|
||||
psShowOverAll(this);
|
||||
activateWindow();
|
||||
setFocus();
|
||||
}
|
||||
displayFinished();
|
||||
}
|
||||
|
||||
void MediaView::displayDocument(DocumentData *doc, HistoryItem *item) { // empty messages shown as docs: doc can be NULL
|
||||
@ -1330,6 +1323,10 @@ void MediaView::displayDocument(DocumentData *doc, HistoryItem *item) { // empty
|
||||
_from = _user;
|
||||
}
|
||||
_full = 1;
|
||||
displayFinished();
|
||||
}
|
||||
|
||||
void MediaView::displayFinished() {
|
||||
updateControls();
|
||||
if (isHidden()) {
|
||||
psUpdateOverlayed(this);
|
||||
|
@ -132,6 +132,7 @@ private slots:
|
||||
private:
|
||||
void displayPhoto(PhotoData *photo, HistoryItem *item);
|
||||
void displayDocument(DocumentData *doc, HistoryItem *item);
|
||||
void displayFinished();
|
||||
void findCurrent();
|
||||
void loadBack();
|
||||
|
||||
|
@ -22,6 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
#include "window/notifications_manager_default.h"
|
||||
|
||||
#include "platform/platform_notifications_manager.h"
|
||||
#include "application.h"
|
||||
#include "mainwindow.h"
|
||||
#include "lang.h"
|
||||
#include "ui/buttons/icon_button.h"
|
||||
@ -725,7 +726,12 @@ void Notification::toggleActionButtons(bool visible) {
|
||||
}
|
||||
|
||||
void Notification::showReplyField() {
|
||||
if (_replyArea) return;
|
||||
activateWindow();
|
||||
|
||||
if (_replyArea) {
|
||||
_replyArea->setFocus();
|
||||
return;
|
||||
}
|
||||
stopHiding();
|
||||
|
||||
_background = new Background(this);
|
||||
@ -739,6 +745,9 @@ void Notification::showReplyField() {
|
||||
_replyArea->setFocus();
|
||||
_replyArea->setMaxLength(MaxMessageSize);
|
||||
_replyArea->setCtrlEnterSubmit(CtrlEnterSubmitBoth);
|
||||
|
||||
// Catch mouse press event to activate the window.
|
||||
Sandbox::installEventFilter(this);
|
||||
connect(_replyArea, SIGNAL(resized()), this, SLOT(onReplyResize()));
|
||||
connect(_replyArea, SIGNAL(submitted(bool)), this, SLOT(onReplySubmit(bool)));
|
||||
connect(_replyArea, SIGNAL(cancelled()), this, SLOT(onReplyCancel()));
|
||||
@ -820,6 +829,17 @@ void Notification::mousePressEvent(QMouseEvent *e) {
|
||||
}
|
||||
}
|
||||
|
||||
bool Notification::eventFilter(QObject *o, QEvent *e) {
|
||||
if (e->type() == QEvent::MouseButtonPress) {
|
||||
if (auto receiver = qobject_cast<QWidget*>(o)) {
|
||||
if (isAncestorOf(receiver)) {
|
||||
activateWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Notification::stopHiding() {
|
||||
if (!_history) return;
|
||||
_hideTimer.stop();
|
||||
|
@ -208,6 +208,7 @@ protected:
|
||||
void leaveEvent(QEvent *e) override;
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
void mousePressEvent(QMouseEvent *e) override;
|
||||
bool eventFilter(QObject *o, QEvent *e) override;
|
||||
|
||||
private slots:
|
||||
void onHideByTimer();
|
||||
|
Loading…
Reference in New Issue
Block a user