Fixup 527984ed: fix initial screen size when using backing store

When using a back store, it is obviously important to resize it
whenever the buffer view is resized. The new code path added in
527984ed skipped this part, so that the window was wrong when creating
a new window.
This commit is contained in:
Jean-Marc Lasgouttes 2024-05-07 12:01:34 +02:00
parent 9f33db8f53
commit ec9d0a9420

View File

@ -464,6 +464,9 @@ void GuiWorkArea::resizeBufferView()
busy(true);
bool const caret_in_view = d->buffer_view_->caretInView();
// Change backing store size if needed
d->resetScreen();
// Do the actual work: recompute metrics
d->buffer_view_->resize(viewport()->width(), viewport()->height());
if (caret_in_view)
d->buffer_view_->showCursor();
@ -1391,10 +1394,8 @@ void GuiWorkArea::paintEvent(QPaintEvent * ev)
// LYXERR(Debug::PAINTING, "paintEvent begin: x: " << rc.x()
// << " y: " << rc.y() << " w: " << rc.width() << " h: " << rc.height());
if (d->need_resize_ || pixelRatio() != d->last_pixel_ratio_) {
d->resetScreen();
if (d->need_resize_ || pixelRatio() != d->last_pixel_ratio_)
resizeBufferView();
}
d->last_pixel_ratio_ = pixelRatio();