]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiWorkArea.cpp
Some improvements to the graphics dialog
[lyx.git] / src / frontends / qt4 / GuiWorkArea.cpp
index c4463e3d3b41c007fa967cc2e21b0fc362ec886e..6df7e4e2909b51caf81d907f5027ff7b5fc3a699 100644 (file)
@@ -306,6 +306,7 @@ void GuiWorkArea::init()
                        generateSyntheticMouseEvent();
                });
 
+       d->resetScreen();
        // With Qt4.5 a mouse event will happen before the first paint event
        // so make sure that the buffer view has an up to date metrics.
        d->buffer_view_->resize(viewport()->width(), viewport()->height());
@@ -1246,12 +1247,15 @@ 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_)
+       if (d->need_resize_ || pixelRatio() != d->last_pixel_ratio_) {
+               d->resetScreen();
                d->resizeBufferView();
+       }
 
        d->last_pixel_ratio_ = pixelRatio();
 
-       GuiPainter pain(viewport(), pixelRatio());
+       GuiPainter pain(d->screenDevice(), pixelRatio());
+
        d->buffer_view_->draw(pain, d->caret_visible_);
 
        // The preedit text, if needed
@@ -1260,6 +1264,9 @@ void GuiWorkArea::paintEvent(QPaintEvent * ev)
        // and the caret
        if (d->caret_visible_)
                d->caret_->draw(pain);
+
+       d->updateScreen(ev->rect());
+
        ev->accept();
 }