mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Don't steal window focus to viewer on another screen.
This commit is contained in:
parent
18ebaeb726
commit
137c13c9c0
3 changed files with 9 additions and 4 deletions
|
@ -1490,10 +1490,7 @@ void Application::windowActivated(not_null<Window::Controller*> window) {
|
||||||
nowSession->updates().updateOnline();
|
nowSession->updates().updateOnline();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_mediaView
|
if (_mediaView && _mediaView->takeFocusFrom(now->widget())) {
|
||||||
&& !_mediaView->isHidden()
|
|
||||||
&& !_mediaView->isMinimized()
|
|
||||||
&& _mediaView->isFullScreen()) {
|
|
||||||
_mediaView->activate();
|
_mediaView->activate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2741,6 +2741,13 @@ void OverlayWidget::setFocus() {
|
||||||
_widget->setFocus();
|
_widget->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OverlayWidget::takeFocusFrom(not_null<QWidget*> window) const {
|
||||||
|
return _fullscreen
|
||||||
|
&& !isHidden()
|
||||||
|
&& !isMinimized()
|
||||||
|
&& (_window->screen() == window->screen());
|
||||||
|
}
|
||||||
|
|
||||||
void OverlayWidget::activate() {
|
void OverlayWidget::activate() {
|
||||||
_window->raise();
|
_window->raise();
|
||||||
_window->activateWindow();
|
_window->activateWindow();
|
||||||
|
|
|
@ -88,6 +88,7 @@ public:
|
||||||
void hide();
|
void hide();
|
||||||
void setCursor(style::cursor cursor);
|
void setCursor(style::cursor cursor);
|
||||||
void setFocus();
|
void setFocus();
|
||||||
|
[[nodiscard]] bool takeFocusFrom(not_null<QWidget*> window) const;
|
||||||
void activate();
|
void activate();
|
||||||
|
|
||||||
void show(OpenRequest request);
|
void show(OpenRequest request);
|
||||||
|
|
Loading…
Add table
Reference in a new issue