Allow tracking isLayerShown in LayerManager.
This commit is contained in:
parent
bf4cb33fab
commit
ff1d5fce29
2 changed files with 9 additions and 0 deletions
|
|
@ -168,6 +168,8 @@ void LayerManager::ensureLayerCreated() {
|
||||||
) | rpl::start_with_next([=](QSize size) {
|
) | rpl::start_with_next([=](QSize size) {
|
||||||
_layer->resize(size);
|
_layer->resize(size);
|
||||||
}, _layer->lifetime());
|
}, _layer->lifetime());
|
||||||
|
|
||||||
|
_layerShown = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerManager::destroyLayer() {
|
void LayerManager::destroyLayer() {
|
||||||
|
|
@ -176,6 +178,8 @@ void LayerManager::destroyLayer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
auto layer = base::take(_layer);
|
auto layer = base::take(_layer);
|
||||||
|
_layerShown = false;
|
||||||
|
|
||||||
const auto resetFocus = Ui::InFocusChain(layer);
|
const auto resetFocus = Ui::InFocusChain(layer);
|
||||||
if (resetFocus) {
|
if (resetFocus) {
|
||||||
_widget->setFocus();
|
_widget->setFocus();
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,10 @@ public:
|
||||||
void raise();
|
void raise();
|
||||||
bool setFocus();
|
bool setFocus();
|
||||||
|
|
||||||
|
[[nodiscard]] rpl::producer<bool> layerShownValue() const {
|
||||||
|
return _layerShown.value();
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] not_null<Ui::RpWidget*> toastParent() const {
|
[[nodiscard]] not_null<Ui::RpWidget*> toastParent() const {
|
||||||
return _widget;
|
return _widget;
|
||||||
}
|
}
|
||||||
|
|
@ -58,6 +62,7 @@ private:
|
||||||
const not_null<RpWidget*> _widget;
|
const not_null<RpWidget*> _widget;
|
||||||
base::unique_qptr<LayerStackWidget> _layer;
|
base::unique_qptr<LayerStackWidget> _layer;
|
||||||
std::shared_ptr<ManagerShow> _cachedShow;
|
std::shared_ptr<ManagerShow> _cachedShow;
|
||||||
|
rpl::variable<bool> _layerShown;
|
||||||
|
|
||||||
const style::Box *_boxSt = nullptr;
|
const style::Box *_boxSt = nullptr;
|
||||||
const style::Box *_layerSt = nullptr;
|
const style::Box *_layerSt = nullptr;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue