mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Use RpWidget::screenValue
This commit is contained in:
parent
5180e0ec57
commit
006d6fe2c0
5 changed files with 18 additions and 26 deletions
|
@ -633,10 +633,10 @@ OverlayWidget::OverlayWidget()
|
||||||
_widget->setMouseTracking(true);
|
_widget->setMouseTracking(true);
|
||||||
_window->createWinId();
|
_window->createWinId();
|
||||||
|
|
||||||
QObject::connect(
|
_window->screenValue(
|
||||||
window(),
|
) | rpl::skip(1) | rpl::start_with_next([=](not_null<QScreen*> screen) {
|
||||||
&QWindow::screenChanged,
|
handleScreenChanged(screen);
|
||||||
[=](QScreen *screen) { handleScreenChanged(screen); });
|
}, lifetime());
|
||||||
subscribeToScreenGeometry();
|
subscribeToScreenGeometry();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
updateControlsGeometry();
|
updateControlsGeometry();
|
||||||
|
@ -2315,7 +2315,7 @@ void OverlayWidget::dropdownHidden() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayWidget::handleScreenChanged(QScreen *screen) {
|
void OverlayWidget::handleScreenChanged(not_null<QScreen*> screen) {
|
||||||
subscribeToScreenGeometry();
|
subscribeToScreenGeometry();
|
||||||
if (isHidden()) {
|
if (isHidden()) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -303,7 +303,7 @@ private:
|
||||||
bool moveToNext(int delta);
|
bool moveToNext(int delta);
|
||||||
void preloadData(int delta);
|
void preloadData(int delta);
|
||||||
|
|
||||||
void handleScreenChanged(QScreen *screen);
|
void handleScreenChanged(not_null<QScreen*> screen);
|
||||||
|
|
||||||
[[nodiscard]] bool computeSaveButtonVisible() const;
|
[[nodiscard]] bool computeSaveButtonVisible() const;
|
||||||
void checkForSaveLoaded();
|
void checkForSaveLoaded();
|
||||||
|
|
|
@ -361,12 +361,10 @@ void PipPanel::init() {
|
||||||
Ui::Platform::ClearTransientParent(widget());
|
Ui::Platform::ClearTransientParent(widget());
|
||||||
}, rp()->lifetime());
|
}, rp()->lifetime());
|
||||||
|
|
||||||
QObject::connect(
|
rp()->screenValue(
|
||||||
widget()->windowHandle(),
|
) | rpl::skip(1) | rpl::start_with_next([=](not_null<QScreen*> screen) {
|
||||||
&QWindow::screenChanged,
|
handleScreenChanged(screen);
|
||||||
[=](QScreen *screen) {
|
}, rp()->lifetime());
|
||||||
handleScreenChanged(screen);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (Platform::IsWayland()) {
|
if (Platform::IsWayland()) {
|
||||||
rp()->sizeValue(
|
rp()->sizeValue(
|
||||||
|
@ -637,7 +635,7 @@ void PipPanel::handleWaylandResize(QSize size) {
|
||||||
_inHandleWaylandResize = false;
|
_inHandleWaylandResize = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PipPanel::handleScreenChanged(QScreen *screen) {
|
void PipPanel::handleScreenChanged(not_null<QScreen*> screen) {
|
||||||
const auto screenGeometry = screen->availableGeometry();
|
const auto screenGeometry = screen->availableGeometry();
|
||||||
const auto minimalSize = _ratio.scaled(
|
const auto minimalSize = _ratio.scaled(
|
||||||
st::pipMinimalSize,
|
st::pipMinimalSize,
|
||||||
|
|
|
@ -77,7 +77,7 @@ public:
|
||||||
[[nodiscard]] bool dragging() const;
|
[[nodiscard]] bool dragging() const;
|
||||||
|
|
||||||
void handleWaylandResize(QSize size);
|
void handleWaylandResize(QSize size);
|
||||||
void handleScreenChanged(QScreen *screen);
|
void handleScreenChanged(not_null<QScreen*> screen);
|
||||||
void handleMousePress(QPoint position, Qt::MouseButton button);
|
void handleMousePress(QPoint position, Qt::MouseButton button);
|
||||||
void handleMouseRelease(QPoint position, Qt::MouseButton button);
|
void handleMouseRelease(QPoint position, Qt::MouseButton button);
|
||||||
void handleMouseMove(QPoint position);
|
void handleMouseMove(QPoint position);
|
||||||
|
|
|
@ -957,21 +957,15 @@ void MainMenu::drawName(Painter &p) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainMenu::initResetScaleButton() {
|
void MainMenu::initResetScaleButton() {
|
||||||
if (!window() || !window()->windowHandle()) {
|
_controller->widget()->screenValue(
|
||||||
return;
|
) | rpl::map([](not_null<QScreen*> screen) {
|
||||||
}
|
|
||||||
const auto handle = window()->windowHandle();
|
|
||||||
rpl::single(
|
|
||||||
handle->screen()
|
|
||||||
) | rpl::then(
|
|
||||||
base::qt_signal_producer(handle, &QWindow::screenChanged)
|
|
||||||
) | rpl::filter([](QScreen *screen) {
|
|
||||||
return screen != nullptr;
|
|
||||||
}) | rpl::map([](QScreen * screen) {
|
|
||||||
return rpl::single(
|
return rpl::single(
|
||||||
screen->availableGeometry()
|
screen->availableGeometry()
|
||||||
) | rpl::then(
|
) | rpl::then(
|
||||||
base::qt_signal_producer(screen, &QScreen::availableGeometryChanged)
|
base::qt_signal_producer(
|
||||||
|
screen.get(),
|
||||||
|
&QScreen::availableGeometryChanged
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}) | rpl::flatten_latest(
|
}) | rpl::flatten_latest(
|
||||||
) | rpl::map([](QRect available) {
|
) | rpl::map([](QRect available) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue