Bug 693494

Summary: Add support for XF86XK_Forward and XF86XK_Back keys for Linux
Product: MuPDF Reporter: muhpdf
Component: appsAssignee: MuPDF bugs <mupdf-bugs>
Status: RESOLVED FIXED    
Severity: enhancement CC: michael, tor.andersson
Priority: P4    
Version: 1.1   
Hardware: PC   
OS: Linux   
Customer: Word Size: ---

Description muhpdf 2012-12-09 10:37:35 UTC
Some keyboards have keys that emit the XF86XK_Forward and XF86XK_Back key codes.
These key codes are usually supported by web browsers to go forwards or backwards in history.

I patched my mupdf so that pressing these keys will turn to the previous or next page. On my keyboard these keys are easier to reach than page_up and page_down.

Maybe some other people will also like this. So, here's what to do:

In the file

apps/x11_main.c

add the header line

#include <X11/XF86keysym.h>

and in the section for deciding which direction keys were pressed, add the two lines that have a comment after them

switch (keysym)
{
case XK_Escape:
	len = 1; buf[0] = '\033';
	break;

case XK_Up:
	len = 1; buf[0] = 'k';
	break;
case XK_Down:
	len = 1; buf[0] = 'j';
	break;

case XK_Left:
	len = 1; buf[0] = 'b';
	break;
case XK_Right:
	len = 1; buf[0] = ' ';
	break;

case XK_Page_Up:
case XF86XK_Back: //add this line
	len = 1; buf[0] = ',';
	break;
case XK_Page_Down:
case XF86XK_Forward: //add this line
	len = 1; buf[0] = '.';
	break;
}
Comment 2 Tor Andersson 2014-05-27 05:50:57 UTC
commit 2f1f3840295b8152d44d00a3c14b58a737baefa7
Author: Tor Andersson <tor.andersson@artifex.com>
Date:   Tue May 27 14:48:28 2014 +0200

    Fix 693494: Support media buttons for navigation on X11.