shithub: puzzles

Download patch

ref: d0500732f7bdab97ecaece2c5c74dd18f8122ea4
parent: ef5c017a5f6863b5f8f2085b0c26106765d73ffb
author: Jonas Kölker <jonaskoelker@yahoo.com>
date: Fri Oct 2 14:17:15 EDT 2015

In GTK frontend, bind mouse8/mouse9 to undo/redo.

These button codes are generated by the back/forward button pair on
the sides of some mice, and web browsers treat these as the back and
forward actions in the page history.

--- a/gtk.c
+++ b/gtk.c
@@ -1205,10 +1205,14 @@
 	button = RIGHT_BUTTON;
     else if (event->button == 1)
 	button = LEFT_BUTTON;
+    else if (event->button == 8 && event->type == GDK_BUTTON_PRESS)
+        button = 'u';
+    else if (event->button == 9 && event->type == GDK_BUTTON_PRESS)
+        button = 'r';
     else
 	return FALSE;		       /* don't even know what button! */
 
-    if (event->type == GDK_BUTTON_RELEASE)
+    if (event->type == GDK_BUTTON_RELEASE && button >= LEFT_BUTTON)
         button += LEFT_RELEASE - LEFT_BUTTON;
 
     if (!midend_process_key(fe->me, event->x - fe->ox,