mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
Better handle window hide / activate in macOS. #1278
When we hide window by 'x' title button or by cmd+w key we try to deactivate the whole application (so some other app gets activated). When we activate the application in any way we check if the main window is hidden and if it is - we show it and activate it.
This commit is contained in:
@@ -912,13 +912,28 @@ void AppClass::checkLocalTime() {
|
||||
}
|
||||
|
||||
void AppClass::onAppStateChanged(Qt::ApplicationState state) {
|
||||
if (state == Qt::ApplicationActive) {
|
||||
handleAppActivated();
|
||||
} else {
|
||||
handleAppDeactivated();
|
||||
}
|
||||
}
|
||||
|
||||
void AppClass::handleAppActivated() {
|
||||
checkLocalTime();
|
||||
if (_window) {
|
||||
_window->updateIsActive((state == Qt::ApplicationActive) ? Global::OnlineFocusTimeout() : Global::OfflineBlurTimeout());
|
||||
if (_window->isHidden()) {
|
||||
_window->showFromTray();
|
||||
}
|
||||
_window->updateIsActive(Global::OnlineFocusTimeout());
|
||||
}
|
||||
if (state != Qt::ApplicationActive) {
|
||||
Ui::Tooltip::Hide();
|
||||
}
|
||||
|
||||
void AppClass::handleAppDeactivated() {
|
||||
if (_window) {
|
||||
_window->updateIsActive(Global::OfflineBlurTimeout());
|
||||
}
|
||||
Ui::Tooltip::Hide();
|
||||
}
|
||||
|
||||
void AppClass::call_handleHistoryUpdate() {
|
||||
|
Reference in New Issue
Block a user