mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-01-10 16:59:55 +00:00
hiding, not destroying window on close on OS X, fixed app event filter
This commit is contained in:
parent
19d395a946
commit
f2c45df524
@ -1016,7 +1016,7 @@ historyToEndSkip: 10px;
|
||||
activeFadeInDuration: 500;
|
||||
activeFadeOutDuration: 3000;
|
||||
|
||||
historyMaxWidth: 640px;
|
||||
historyMaxWidth: 680px;
|
||||
|
||||
msgRadius: 3px;
|
||||
|
||||
|
@ -57,15 +57,8 @@ namespace {
|
||||
QKeyEvent *ev = static_cast<QKeyEvent*>(e);
|
||||
if (cPlatform() == dbipMac || cPlatform() == dbipMacOld) {
|
||||
if (ev->key() == Qt::Key_W && (ev->modifiers() & Qt::ControlModifier)) {
|
||||
if (cWorkMode() == dbiwmTrayOnly || cWorkMode() == dbiwmWindowAndTray) {
|
||||
App::wnd()->minimizeToTray();
|
||||
return true;
|
||||
} else {
|
||||
App::wnd()->hide();
|
||||
App::wnd()->updateIsActive(cOfflineBlurTimeout());
|
||||
App::wnd()->updateGlobalMenu();
|
||||
return true;
|
||||
}
|
||||
Ui::hideWindowNoQuit();
|
||||
return true;
|
||||
} else if (ev->key() == Qt::Key_M && (ev->modifiers() & Qt::ControlModifier)) {
|
||||
App::wnd()->setWindowState(Qt::WindowMinimized);
|
||||
return true;
|
||||
|
@ -134,6 +134,22 @@ namespace Ui {
|
||||
}
|
||||
}
|
||||
|
||||
bool hideWindowNoQuit() {
|
||||
if (!App::quiting()) {
|
||||
if (Window *w = App::wnd()) {
|
||||
if (cWorkMode() == dbiwmTrayOnly || cWorkMode() == dbiwmWindowAndTray) {
|
||||
return w->minimizeToTray();
|
||||
} else if (cPlatform() == dbipMac || cPlatform() == dbipMacOld) {
|
||||
w->hide();
|
||||
w->updateIsActive(cOfflineBlurTimeout());
|
||||
w->updateGlobalMenu();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace Notify {
|
||||
|
@ -67,6 +67,8 @@ namespace Ui {
|
||||
showPeerHistory(PeerId(0), 0);
|
||||
}
|
||||
|
||||
bool hideWindowNoQuit();
|
||||
|
||||
};
|
||||
|
||||
enum ClipStopperType {
|
||||
|
@ -990,7 +990,7 @@ bool Window::eventFilter(QObject *obj, QEvent *evt) {
|
||||
} else if (t == QEvent::MouseButtonRelease) {
|
||||
Ui::hideStickerPreview();
|
||||
}
|
||||
if (obj == App::app()) {
|
||||
if (obj == Application::instance()) {
|
||||
if (t == QEvent::ApplicationActivate) {
|
||||
psUserActionDone();
|
||||
QTimer::singleShot(1, this, SLOT(checkHistoryActivation()));
|
||||
@ -1214,7 +1214,7 @@ void Window::toggleDisplayNotifyFromTray() {
|
||||
}
|
||||
|
||||
void Window::closeEvent(QCloseEvent *e) {
|
||||
if (MTP::authedId() && !Sandbox::isSavingSession() && minimizeToTray()) {
|
||||
if (MTP::authedId() && !Sandbox::isSavingSession() && Ui::hideWindowNoQuit()) {
|
||||
e->ignore();
|
||||
} else {
|
||||
App::quit();
|
||||
|
Loading…
Reference in New Issue
Block a user