mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +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();
|
||||
}
|
||||
}
|
||||
if (_mediaView
|
||||
&& !_mediaView->isHidden()
|
||||
&& !_mediaView->isMinimized()
|
||||
&& _mediaView->isFullScreen()) {
|
||||
if (_mediaView && _mediaView->takeFocusFrom(now->widget())) {
|
||||
_mediaView->activate();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2741,6 +2741,13 @@ void OverlayWidget::setFocus() {
|
|||
_widget->setFocus();
|
||||
}
|
||||
|
||||
bool OverlayWidget::takeFocusFrom(not_null<QWidget*> window) const {
|
||||
return _fullscreen
|
||||
&& !isHidden()
|
||||
&& !isMinimized()
|
||||
&& (_window->screen() == window->screen());
|
||||
}
|
||||
|
||||
void OverlayWidget::activate() {
|
||||
_window->raise();
|
||||
_window->activateWindow();
|
||||
|
|
|
@ -88,6 +88,7 @@ public:
|
|||
void hide();
|
||||
void setCursor(style::cursor cursor);
|
||||
void setFocus();
|
||||
[[nodiscard]] bool takeFocusFrom(not_null<QWidget*> window) const;
|
||||
void activate();
|
||||
|
||||
void show(OpenRequest request);
|
||||
|
|
Loading…
Add table
Reference in a new issue