I use Xournal to make slides, and for pages where the height
is roughly the same size as the viewport, Xournal's default
behavior works poorly because you have to scroll *all the way
past the edge* of the current page before it switches the current
page. This leads to non-intuitive behavior with copy/paste, especially.

Here is a proposed alternative. I invite you to try it out and
see if you like it.

commit 9de72147e9e963965a656bbf4bb64693c0a1a2a1
Author: Edward Z. Yang <ezy...@cs.stanford.edu>
Date:   Wed Oct 15 18:06:03 2014 -0700

    Adjust current page based on viewport middle.
    
    This algo works pretty poorly when pages are extremely small
    relative to viewport size (essentially, it is very difficult
    to get a focus on the first/last pages); however, I find it
    a lot more user-friendly for figuring out which page I'm on when
    dealing with mid-sized pages.
    
    Signed-off-by: Edward Z. Yang <ezy...@cs.stanford.edu>

diff --git a/src/xo-callbacks.c b/src/xo-callbacks.c
index 219cf2b..467e07a 100644
--- a/src/xo-callbacks.c
+++ b/src/xo-callbacks.c
@@ -3167,23 +3167,22 @@ on_vscroll_changed                     (GtkAdjustment   
*adjustment,
                                         gpointer         user_data)
 {
   gboolean need_update;
-  double viewport_top, viewport_bottom;
+  double viewport_middle;
   struct Page *tmppage;
   
   if (ui.view_continuous!=VIEW_MODE_CONTINUOUS) return;
   
   if (ui.progressive_bg) rescale_bg_pixmaps();
   need_update = FALSE;
-  viewport_top = adjustment->value / ui.zoom;
-  viewport_bottom = (adjustment->value + adjustment->page_size) / ui.zoom;
+  viewport_middle = (2 * adjustment->value + adjustment->page_size) / (2 * 
ui.zoom);
   tmppage = ui.cur_page;
-  while (viewport_top > tmppage->voffset + tmppage->height) {
+  while (viewport_middle > tmppage->voffset + tmppage->height) {
     if (ui.pageno == journal.npages-1) break;
     need_update = TRUE;
     ui.pageno++;
     tmppage = g_list_nth_data(journal.pages, ui.pageno);
   }
-  while (viewport_bottom < tmppage->voffset) {
+  while (viewport_middle < tmppage->voffset) {
     if (ui.pageno == 0) break;
     need_update = TRUE;
     ui.pageno--;

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Xournal-devel mailing list
Xournal-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xournal-devel

Reply via email to