Skip to content

Instantly share code, notes, and snippets.

@puddingpimp
Created May 25, 2013 14:19
Show Gist options
  • Save puddingpimp/5649218 to your computer and use it in GitHub Desktop.
Save puddingpimp/5649218 to your computer and use it in GitHub Desktop.
Fix scrolling in mupdf and use back/forward buttons for page turns
diff --git a/apps/pdfapp.c b/apps/pdfapp.c
index 887d823..37eed92 100644
--- a/apps/pdfapp.c
+++ b/apps/pdfapp.c
@@ -1402,7 +1402,8 @@ void pdfapp_onmouse(pdfapp_t *app, int x, int y, int btn, int modifiers, int sta
int newy = app->pany + y - app->sely;
/* Scrolling beyond limits implies flipping pages */
/* Are we requested to scroll beyond limits? */
- if (newy + fz_pixmap_height(app->ctx, app->image) < app->winh || newy > 0)
+ /* if (newy + fz_pixmap_height(app->ctx, app->image) < app->winh || newy > 0) */
+ if (0) /* no, fuck this shit */
{
/* Yes. We can assume that deltay != 0 */
int deltay = y - app->sely;
diff --git a/apps/x11_main.c b/apps/x11_main.c
index 1c0ca0b..6cc205f 100644
--- a/apps/x11_main.c
+++ b/apps/x11_main.c
@@ -5,6 +5,7 @@
#include <X11/Xatom.h>
#include <X11/cursorfont.h>
#include <X11/keysym.h>
+#include <X11/XF86keysym.h>
#include <sys/select.h>
#include <sys/time.h>
@@ -829,9 +830,16 @@ int main(int argc, char **argv)
break;
case XK_Left:
- len = 1; buf[0] = 'b';
+ len = 1; buf[0] = 'h';
break;
case XK_Right:
+ len = 1; buf[0] = 'l';
+ break;
+
+ case XF86XK_Back:
+ len = 1; buf[0] = 'b';
+ break;
+ case XF86XK_Forward:
len = 1; buf[0] = ' ';
break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment