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

[gnome-love] Re: GTK+, horizontal scrolling and mice with two wheels



Le 28/05/01 23:40:04, Thomas Broyer a écrit :
> I guess it's inside gdk/x11/gdkevents-x11.c (it doesn't seem there are
> GDK_SCROLL events with nanox and linux-fb, and I'm totally ignorant in
> Windows programming) in the gdk_event_translate() function, ButtonPress
> case in the switch (xevent->type) but is this sufficient? (I looked at
> gtk/gtkscrolledwindow.c and it seems horizontal scrolls

Here comes a patch against gtk+-1.3.5 to add support for buttons 6 and 7 in
GDK/X11 (generating GDK_SCROLL events with GDK_SCROLL_LEFT and
GDK_SCROLL_RIGHT directions respectively).
I recompiled my modified gtk+ and tried gtk-demo, it works! I can scroll
"source" text views vertically with the first mouse wheel and horizontally
with the second one.
That's great !!!

Should I open a bugzilla account and post it there too? Or should I send it
to gtk-devel-list?

There's still a need to implement this on Windows, should I open "TODO
task"?

Discussion on horizontal scrolling with single-wheel mice will go to the
gtk-list

Tom.
--- gdk/x11/gdkevents-x11.c.old	Tue May 29 00:26:37 2001
+++ gdk/x11/gdkevents-x11.c	Tue May 29 00:30:48 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;


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