mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix child native window focus.
This commit is contained in:
parent
fd982b90db
commit
c70866a995
2 changed files with 14 additions and 14 deletions
|
@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include "base/platform/base_platform_info.h"
|
#include "base/platform/base_platform_info.h"
|
||||||
#include "base/invoke_queued.h"
|
#include "base/invoke_queued.h"
|
||||||
|
#include "base/qt_signal_producer.h"
|
||||||
#include "base/qthelp_url.h"
|
#include "base/qthelp_url.h"
|
||||||
#include "iv/iv_data.h"
|
#include "iv/iv_data.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
|
@ -35,6 +36,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include <QtCore/QJsonObject>
|
#include <QtCore/QJsonObject>
|
||||||
#include <QtCore/QJsonValue>
|
#include <QtCore/QJsonValue>
|
||||||
#include <QtCore/QFile>
|
#include <QtCore/QFile>
|
||||||
|
#include <QtGui/QGuiApplication>
|
||||||
#include <QtGui/QPainter>
|
#include <QtGui/QPainter>
|
||||||
#include <QtGui/QWindow>
|
#include <QtGui/QWindow>
|
||||||
#include <charconv>
|
#include <charconv>
|
||||||
|
@ -280,14 +282,13 @@ void Controller::createWindow() {
|
||||||
_window = std::make_unique<Ui::RpWindow>();
|
_window = std::make_unique<Ui::RpWindow>();
|
||||||
const auto window = _window.get();
|
const auto window = _window.get();
|
||||||
|
|
||||||
window->windowActiveValue(
|
base::qt_signal_producer(
|
||||||
) | rpl::map([=] {
|
qApp,
|
||||||
|
&QGuiApplication::focusWindowChanged
|
||||||
|
) | rpl::filter([=](QWindow *focused) {
|
||||||
const auto handle = window->window()->windowHandle();
|
const auto handle = window->window()->windowHandle();
|
||||||
return (_shareFocus || _webview) && handle && handle->isActive();
|
return _webview && handle && (focused == handle);
|
||||||
}) | rpl::distinct_until_changed(
|
}) | rpl::start_with_next([=] {
|
||||||
) | rpl::filter(
|
|
||||||
rpl::mappers::_1
|
|
||||||
) | rpl::start_with_next([=] {
|
|
||||||
setInnerFocus();
|
setInnerFocus();
|
||||||
}, window->lifetime());
|
}, window->lifetime());
|
||||||
|
|
||||||
|
|
|
@ -741,17 +741,16 @@ postEvent: function(eventType, eventData) {
|
||||||
|
|
||||||
setupProgressGeometry();
|
setupProgressGeometry();
|
||||||
|
|
||||||
_widget->windowActiveValue(
|
base::qt_signal_producer(
|
||||||
) | rpl::map([=] {
|
qApp,
|
||||||
|
&QGuiApplication::focusWindowChanged
|
||||||
|
) | rpl::filter([=](QWindow *focused) {
|
||||||
const auto handle = _widget->window()->windowHandle();
|
const auto handle = _widget->window()->windowHandle();
|
||||||
return _webview
|
return _webview
|
||||||
&& !_webview->window.widget()->isHidden()
|
&& !_webview->window.widget()->isHidden()
|
||||||
&& handle
|
&& handle
|
||||||
&& handle->isActive();
|
&& (focused == handle);
|
||||||
}) | rpl::distinct_until_changed(
|
}) | rpl::start_with_next([=] {
|
||||||
) | rpl::filter(
|
|
||||||
rpl::mappers::_1
|
|
||||||
) | rpl::start_with_next([=] {
|
|
||||||
_webview->window.focus();
|
_webview->window.focus();
|
||||||
}, _webview->lifetime);
|
}, _webview->lifetime);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue