mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-30 22:16:14 +00:00
Activate mediaview instead of main window.
If the mediaview is currently shown and we receive an activation event for the main window we should activate and focus mediaview.
This commit is contained in:
@@ -190,6 +190,9 @@ void MainWindow::init() {
|
||||
initHook();
|
||||
updateWindowIcon();
|
||||
|
||||
connect(windowHandle(), &QWindow::activeChanged, this, [this] { handleActiveChanged(); }, Qt::QueuedConnection);
|
||||
connect(windowHandle(), &QWindow::windowStateChanged, this, [this](Qt::WindowState state) { handleStateChanged(state); });
|
||||
|
||||
_positionUpdatedTimer->setSingleShot(true);
|
||||
connect(_positionUpdatedTimer, SIGNAL(timeout()), this, SLOT(savePositionByTimer()));
|
||||
|
||||
@@ -203,6 +206,26 @@ void MainWindow::init() {
|
||||
updateUnreadCounter();
|
||||
}
|
||||
|
||||
void MainWindow::handleStateChanged(Qt::WindowState state) {
|
||||
stateChangedHook(state);
|
||||
updateIsActive((state == Qt::WindowMinimized) ? Global::OfflineBlurTimeout() : Global::OnlineFocusTimeout());
|
||||
psUserActionDone();
|
||||
if (state == Qt::WindowMinimized && Global::WorkMode().value() == dbiwmTrayOnly) {
|
||||
minimizeToTray();
|
||||
}
|
||||
savePosition(state);
|
||||
}
|
||||
|
||||
void MainWindow::handleActiveChanged() {
|
||||
if (isActiveWindow() && _mediaView && !_mediaView->isHidden()) {
|
||||
_mediaView->activateWindow();
|
||||
_mediaView->setFocus();
|
||||
}
|
||||
App::CallDelayed(1, this, [this] {
|
||||
updateTrayMenu();
|
||||
});
|
||||
}
|
||||
|
||||
void MainWindow::updatePalette() {
|
||||
auto p = palette();
|
||||
p.setColor(QPalette::Window, st::windowBg->c);
|
||||
|
Reference in New Issue
Block a user