Two-wheels mice support



Hi,

I posted the attached patch to gnome-love and opened a bugzilla enhancement
too, and Chema suggested I also send it here.

So what's all about? The patch (against gtk+-1.3.5) adds support in GDK for
two-wheels mice, generating GDK_SCROLL_LEFT and GDK_SCROLL_RIGHT events for
buttons 6 and 7.

This is only for GDK/X11; someone will have to do the same for Windows.

Tom.
P.S.: please Cc me as I'm not subscribed to this list
--- gdk/x11/gdkevents-x11.c.old	Tue May 29 18:16:35 2001
+++ gdk/x11/gdkevents-x11.c	Tue May 29 18:27:54 2001
@@ -650,11 +650,14 @@
       
       /* If we get a ButtonPress event where the button is 4 or 5,
 	 it's a Scroll event */
-      if (xevent->xbutton.button == 4 || xevent->xbutton.button == 5)
+      if (xevent->xbutton.button == 4 || xevent->xbutton.button == 5
+	  || xevent->xbutton.button == 6 || xevent->xbutton.button == 7)
 	{
 	  event->scroll.type = GDK_SCROLL;
 	  event->scroll.direction = (xevent->xbutton.button == 4) ? 
-	    GDK_SCROLL_UP : GDK_SCROLL_DOWN;
+	    GDK_SCROLL_UP : (xevent->xbutton.button == 5) ?
+	    GDK_SCROLL_DOWN : (xevent->xbutton.button == 6) ?
+	    GDK_SCROLL_LEFT : GDK_SCROLL_RIGHT;
 	  event->scroll.window = window;
 	  event->scroll.time = xevent->xbutton.x;
 	  event->scroll.x = xevent->xbutton.x + xoffset;
@@ -699,7 +702,8 @@
 	}
       
       /* We treat button presses as scroll wheel events, so ignore the release */
-      if (xevent->xbutton.button == 4 || xevent->xbutton.button == 5)
+      if (xevent->xbutton.button == 4 || xevent->xbutton.button == 5
+	  || xevent->xbutton.button == 6 || xevent->xbutton.button == 7)
 	{
 	  return_val = FALSE;
 	  break;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]