Mouse wheel support for gtk+



I've been messing around with adding support for mouse wheels to gtk+, and I'm wondering if anybody else has been working on the same thing.  
As a temporary measure, I've modified the gtkrange widget to allow scrolling with a mouse wheel.  Unfortunatly, since mouse wheels behave like single clicking mouse buttons 4 and 5, the mouse pointer must be over the range widget (scroll bar) for it to work.  I've included the diff at the bottom of this message if someone wants to integrate it into the main source tree.

I think that I've come up with a better architecture for handling wheel mice (and maybe other variations of the same thing, like if a mouse is made with a hat switch), but I'd like to hear if anyone has already been working on this and if the issues surrounding gtkscrolledwindow have been resolved (I remember seeing some posts about creating a generic scrolled window architecture, but I haven't seen a resolution to the issue)

Cheers,
Grant

Here is the diff on gtkrange.c
[grant@localhost gnome]$ diff ./gtk+-1.1.13/gtk/gtkrange.c ./gtk+/gtk/gtkrange.
864c864,877
<       if (event->window == range->trough)
---
> 
>       if (range->button == 4)
> 	{
> 	  range->scroll_type = GTK_SCROLL_PAGE_BACKWARD;
> 	  gtk_range_scroll (range, jump_perc);
> 	  gtk_range_add_timer (range);
> 	}
>       else if (range->button == 5)
> 	{
> 	  range->scroll_type = GTK_SCROLL_PAGE_FORWARD;
> 	  gtk_range_scroll (range, jump_perc);
> 	  gtk_range_add_timer (range);
> 	}
>       else if (event->window == range->trough)
867c880
< 	  
---
> 
[grant@localhost gnome]$



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