Fix page-jumping-back-issue commonly encountered when in presentation mode

Review Request #130171 - Created July 3, 2017 and updated

Alexander Schlarb

This fixes an issue I've commonly encountered while quickly working myself through large PDFs with many pages (such as this).

Steps to reproduce the issue:

  1. Open Okular
  2. For easily reproducing the issue change Settings ? Performance ? Memory Usage to Greedy (the issue can be reproduced without it, but it's harder an alot more random)
  3. Open a PDF with many pages
  4. Immidiately go to presentation mode (Ctrl+Shift+P)
  5. Click on the screen or press the left-arrow keyboard button

Expected behaviour:

  • The next slide is shown

Actual behaviour:

  • The next slide is indeed shown for a split second before the one is sent back to the first slide (this keeps being the case until all slides have been preloaded, then it stops)
  • Interestingly enough (and I frankly have no idea why) everything works normally if one quickly double-clicks to skip forward by two slides, slides can be viewed normally after that as long as you don't go back to the second slide again…?

This patch fixes the problematic behaviour by removing code that looks its a bogus fixi from something that shouldn't be a problem… maybe.
Unfortunately the one attached comment isn't helpful at all in describing what this check was originally supposed to do – just like the commit message for that change (obtained through git blame):

commit d2d2fa3b2a4fa8f4b554b87ec13ee5a15b64f35d
Author: Mailson Menezes <>
Date:   Sun Nov 11 23:09:12 2012 -0300

    Refactoring PageView

I therefor can only hope that this solution doesn't break anything. Guidance of somebody with in-depth knowledge of the code-base would be apprechiated on this. :-)

Loaded a few different PDFs that had previously exibited the described behaviour and verfied that they are fixed now. Also scrolled through them in non-presentation mode, to verify that nothing else appears to be broken now.

Albert Astals Cid

Sorry but no, you can't fix presentation mode by removing code out of pageview that you claim you don't know what it does. Debug more and come up with a better patch.

  1. Well, can you tell me what that code I'm trying to remove ought to do? (Even a hunch would be super useful!)

  2. Read the code of PageView::slotRequestVisiblePixmaps maybe?