Commit 0c4ed4c0 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Make PageView::notifyViewportChanged call "itself" with a queued connection

This increases the UI responsiveness on opening PDF that are slow to render
This is because we can only have one thread using the pdf because of
poppler, if we do not queue this call, it will immediately try to generate
the pixmap for this page ending up in the thread for rendering being started.
But then while we are still opening the file we will ask if the file
has embedded files, and this means accessing poppler again and we will be
stuck there because the rendering thread has still not finished. This way by
delaying the execution until we return to the event loop we guarantee
all short queries that are done while opening the file are done already and
we won't block the UI
parent d7e116f2
......@@ -978,6 +978,11 @@ void PageView::setLastSourceLocationViewport( const Okular::DocumentViewport& vp
void PageView::notifyViewportChanged( bool smoothMove )
QMetaObject::invokeMethod(this, "slotRealNotifyViewportChanged", Qt::QueuedConnection, Q_ARG( bool, smoothMove ));
void PageView::slotRealNotifyViewportChanged( bool smoothMove )
// if we are the one changing viewport, skip this nofity
if ( d->blockViewport )
......@@ -191,6 +191,8 @@ Q_OBJECT
class PageViewPrivate * d;
private slots:
// used to decouple the notifyViewportChanged calle
void slotRealNotifyViewportChanged(bool smoothMove);
// activated either directly or via queued connection on notifySetup
void slotRelayoutPages();
// activated by the resize event delay timer
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment