mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 15:13:57 +02:00
Try better webview focusing.
This commit is contained in:
parent
8ce10d5503
commit
917d1841c1
2 changed files with 20 additions and 16 deletions
|
@ -9,7 +9,6 @@ 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"
|
||||||
|
@ -281,12 +280,14 @@ 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();
|
||||||
|
|
||||||
base::qt_signal_producer(
|
window->windowActiveValue(
|
||||||
window->window()->windowHandle(),
|
) | rpl::map([=] {
|
||||||
&QWindow::activeChanged
|
const auto handle = window->window()->windowHandle();
|
||||||
) | rpl::filter([=] {
|
return (_shareFocus || _webview) && handle && handle->isActive();
|
||||||
return _webview && window->window()->windowHandle()->isActive();
|
}) | rpl::distinct_until_changed(
|
||||||
}) | rpl::start_with_next([=] {
|
) | rpl::filter(
|
||||||
|
rpl::mappers::_1
|
||||||
|
) | rpl::start_with_next([=] {
|
||||||
setInnerFocus();
|
setInnerFocus();
|
||||||
}, window->lifetime());
|
}, window->lifetime());
|
||||||
|
|
||||||
|
|
|
@ -739,15 +739,18 @@ postEvent: function(eventType, eventData) {
|
||||||
|
|
||||||
setupProgressGeometry();
|
setupProgressGeometry();
|
||||||
|
|
||||||
base::qt_signal_producer(
|
_widget->windowActiveValue(
|
||||||
_widget->window()->windowHandle(),
|
) | rpl::map([=] {
|
||||||
&QWindow::activeChanged
|
const auto handle = _widget->window()->windowHandle();
|
||||||
) | rpl::filter([=] {
|
return _webview
|
||||||
return _webview && _widget->window()->windowHandle()->isActive();
|
&& !_webview->window.widget()->isHidden()
|
||||||
}) | rpl::start_with_next([=] {
|
&& handle
|
||||||
if (_webview && !_webview->window.widget()->isHidden()) {
|
&& handle->isActive();
|
||||||
|
}) | rpl::distinct_until_changed(
|
||||||
|
) | rpl::filter(
|
||||||
|
rpl::mappers::_1
|
||||||
|
) | rpl::start_with_next([=] {
|
||||||
_webview->window.focus();
|
_webview->window.focus();
|
||||||
}
|
|
||||||
}, _webview->lifetime);
|
}, _webview->lifetime);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue