Skip to content

Commit

Permalink
Avoid unnecessary resizing
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-fedin authored and john-preston committed Feb 12, 2024
1 parent c9a5623 commit 18f9560
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions webview/platform/linux/webview_linux_compositor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,12 @@ Chrome::Chrome(
) | rpl::to_empty
) | rpl::map([=] {
return window->size();
}) | rpl::filter([=](const QSize &size) {
}) | rpl::distinct_until_changed(
) | rpl::filter([=](const QSize &size) {
return !size.isEmpty();
}) | rpl::start_with_next([=](const QSize &size) {
if (const auto toplevel = xdgSurface->toplevel()) {
toplevel->sendFullscreen(size);
} else if (const auto popup = xdgSurface->popup()) {
popup->sendConfigure(QRect(QPoint(), size));
}
}, _lifetime);

Expand All @@ -142,17 +141,23 @@ Chrome::Chrome(
return xdgSurface->windowGeometry().isValid()
? xdgSurface->windowGeometry()
: QRect(QPoint(), xdgSurface->surface()->destinationSize());
}) | rpl::distinct_until_changed(
) | rpl::filter([=](const QRect &geometry) {
return geometry.isValid();
}) | rpl::start_with_next([=](const QRect &geometry) {
setX(-geometry.x());
setY(-geometry.y());

if (windowFollowsSize) {
window->resize(geometry.size());
if (xdgSurface->popup()) {
window->setMinimumSize(geometry.size());
window->setMaximumSize(geometry.size());
} else {
window->resize(geometry.size());
}
}

if (!window->size().isEmpty()) {
_completed = true;
}
_completed = true;
}, _lifetime);

if (const auto toplevel = xdgSurface->toplevel()) {
Expand Down

0 comments on commit 18f9560

Please sign in to comment.