[patch] Add 2nd scrollwheel scrolling
- From: rutger null net
- To: gtk-devel-list gnome org
- Subject: [patch] Add 2nd scrollwheel scrolling
- Date: Sun, 29 Oct 2000 13:09:20 +0100
I don't know how or where to submit a patch to Gtk+, but this looks
the right place. Please correct me if I'm wrong.
This patch adds horizontal scrolling with the second scrollwheel, as
is available for example on the A4 Tech Mouse. The first scrollwheel
is reported as buttons 4 and 5, the second as buttons 6 and 7.
The attached diff is against gtk+-1.2.8.
--
Rutger Nijlunsing, rutger @ null.net ----------------------------- Linux! --
Don't BiCapitalize without extremely good reason: it messes up the natural
human-eyeball search order -- Your Friendly Neighborhood Archive Maintainers
+31-40 ----------------------------------------------------------- ^X^S^X^Cs
*** gtk+-1.2.8/gtk/gtkmain.c.orig Sun Oct 29 11:58:19 2000
--- gtk+-1.2.8/gtk/gtkmain.c Sun Oct 29 12:40:42 2000
***************
*** 721,741 ****
* a plausible widget to scroll. We also trap
* button 4-5 double and triple clicks here, since
* they will be generated if the user scrolls quickly.
*/
if ((grab_widget == event_widget) &&
! (event->button.button == 4 || event->button.button == 5))
{
GtkWidget *range = NULL;
GtkWidget *scrollwin;
-
if (GTK_IS_RANGE (event_widget))
range = event_widget;
else
{
scrollwin = gtk_widget_get_ancestor (event_widget,
GTK_TYPE_SCROLLED_WINDOW);
! if (scrollwin)
! range = GTK_SCROLLED_WINDOW (scrollwin)->vscrollbar;
}
if (range && GTK_WIDGET_VISIBLE (range))
--- 721,751 ----
* a plausible widget to scroll. We also trap
* button 4-5 double and triple clicks here, since
* they will be generated if the user scrolls quickly.
+ *
+ * Also assume that button 6-7 controll the second
+ * scrollwheel, which holds e.g. for the A4 tech mouse.
*/
if ((grab_widget == event_widget) &&
! (event->button.button >= 4 && event->button.button <= 7))
{
GtkWidget *range = NULL;
GtkWidget *scrollwin;
if (GTK_IS_RANGE (event_widget))
range = event_widget;
else
{
scrollwin = gtk_widget_get_ancestor (event_widget,
GTK_TYPE_SCROLLED_WINDOW);
! if (scrollwin) {
! int scrollVertically =
! (event->button.button == 4) || (event->button.button == 5);
!
! if (scrollVertically) {
! range = GTK_SCROLLED_WINDOW (scrollwin)->vscrollbar;
! } else {
! range = GTK_SCROLLED_WINDOW (scrollwin)->hscrollbar;
! }
! }
}
if (range && GTK_WIDGET_VISIBLE (range))
***************
*** 743,749 ****
if (event->type == GDK_BUTTON_PRESS)
{
GtkAdjustment *adj = GTK_RANGE (range)->adjustment;
! gfloat new_value = adj->value + ((event->button.button == 4) ?
-adj->page_increment / 2:
adj->page_increment / 2);
new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
--- 753,761 ----
if (event->type == GDK_BUTTON_PRESS)
{
GtkAdjustment *adj = GTK_RANGE (range)->adjustment;
! int adjNegative =
! (event->button.button == 4) || (event->button.button == 6);
! gfloat new_value = adj->value + (adjNegative ?
-adj->page_increment / 2:
adj->page_increment / 2);
new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]