From 0f1da4281d0ff96a0705acaf5e67c038f0a2e8f8 Mon Sep 17 00:00:00 2001 From: Olof S Kylander/GIMP Date: Sat, 4 Sep 1999 14:42:43 +0000 Subject: [PATCH] Added support for Gtk+ xinput-wheel if we have applied the patch enabling Added support for Gtk+ xinput-wheel if we have applied the patch enabling it in Gtk+. --- ChangeLog | 16 ++ README.patch_xinput_airbrush | 74 +++++ app/devices.c | 5 + app/disp_callbacks.c | 18 +- app/display/gimpdisplay-callbacks.c | 18 +- app/display/gimpdisplay-scroll.c | 4 + app/display/gimpdisplayshell-callbacks.c | 18 +- app/display/gimpdisplayshell-scroll.c | 4 + app/gimprc.c | 4 + app/gui/device-status-dialog.c | 5 + app/gui/input-dialog.c | 5 + app/paint_core.c | 39 +++ app/paint_core.h | 20 +- app/scroll.c | 4 + app/tools/paint_core.c | 39 +++ app/tools/paint_core.h | 20 +- app/widgets/gimpdeviceinfo.c | 5 + app/widgets/gimpdevices.c | 5 + modules/colorsel_water.c | 8 + patch_xinput_airbrush | 347 +++++++++++++++++++++++ 20 files changed, 641 insertions(+), 17 deletions(-) create mode 100644 README.patch_xinput_airbrush create mode 100644 patch_xinput_airbrush diff --git a/ChangeLog b/ChangeLog index f6cf63d005..517473f108 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +Sat Sep 4 16:31:50 CEST 1999 Olof S Kylander + + * patch_xinput_airbrush (newfile) + * README.patch_xinput_airbrush (newfile) + * app/devices.c + * app/disp_callbacks.c + * app/gimprc.c + * app/paint_core.[ch] + * app/scroll.c + + - Added support for the sixth valuator in the xf86Wacom driver + please read the README file. + + - Support will only be enabled if the patch is applied + (i.e it is done with "ifdef") + Fri Sep 3 23:26:38 PDT 1999 Manish Singh * app/gtkwrapbox.[ch] diff --git a/README.patch_xinput_airbrush b/README.patch_xinput_airbrush new file mode 100644 index 0000000000..e4c41cd747 --- /dev/null +++ b/README.patch_xinput_airbrush @@ -0,0 +1,74 @@ +This patch enables support of the sixth valuator present in the xf86Wacom +driver. The driver with support of six valuators are included in XFree86 +3.3.4 and newer. + +The purpose of this patch is to enable the airbrush wheel on the Wacom Intous +airbrush device. The wheel is used in the upcoming new airbrush tool in Gimp +to regulate the virtual altitude of your airbrush. + +The patch is tested with Gtk+-1.2.4 (not the CVS version) and should apply +without problems. The patch is totally unsupported in both Gtk and GIMP. + +A good advice it to install a the patched version of Gtk+ and Gimp in a special +directory because of the binary incompatible (See notes below). + +Here is how to make it work, + +cd gtk+-1.2.4 +pacth -p0 ../patch_xinput_airbrush +./configure --prefix=/opt/gimp --with-xinput=xfree +make +make install +cd ../gimp +export LD_LIBRARY_PATH=/opt/gimp/lib:$LD_LIBRARY_PATH +export PATH=/opt/gimp/bin:$PATH +./configure --prefix=/opt/gimp --enable-gimpdir=.gimpairbrush +make +make install + +Now make a special gimp startup script that you install in a directory +that is in your path. + +Here is an example + +#!/bin/sh +PREFIX=/opt/gimp +LD_LIBRARY_PATH=$PREFIX/lib:$LD_LIBRARY_PATH +exec $PREFIX/bin/gimp "$@" + +OBSERVE that the patch makes Gtk+ binary and source incompatible, i.e you can't +run your old compiled Gtk+ apps (which includes GNOME apps) with Gtk+ patched +with this patch. + +This is because the gdk_input_window_get_pointer is changed and now has nine +parameters instead of eight. The added parameter is gdouble *wheel see below, + +void gdk_input_window_get_pointer (GdkWindow *window, + guint32 deviceid, + gdouble *x, + gdouble *y, + gdouble *pressure, + gdouble *xtilt, + gdouble *ytilt, + gdouble *wheel, + GdkModifierType *mask); + +gtkfeatures.h has a new define to enable you to check for the presence of this +patch in your program. You can e.g use it as below + +#ifdef GTK_HAVE_SIX_VALUATORS + +gdk_input_window_get_pointer (event->window, event->deviceid, + NULL, NULL, NULL, NULL, NULL, NULL, NULL); + +#else /* !GTK_HAVE_SIX_VALUATORS */ + +gdk_input_window_get_pointer (event->window, event->deviceid, + NULL, NULL, NULL, NULL, NULL, NULL); + +#endif /* GTK_HAVE_SIX_VALUATORS */ + +Happy Gimping + +Olof S Kylander + diff --git a/app/devices.c b/app/devices.c index 8fbecda94c..10c667fccc 100644 --- a/app/devices.c +++ b/app/devices.c @@ -593,6 +593,11 @@ devices_write_rc_device (DeviceInfo *device_info, case GDK_AXIS_YTILT: axis_type = "ytilt"; break; +#ifdef GTK_HAVE_SIX_VALUATORS + case GDK_AXIS_WHEEL: + axis_type = "wheel"; + break; +#endif /* GTK_HAVE_SIX_VALUATORS */ } fprintf(fp, " %s",axis_type); } diff --git a/app/disp_callbacks.c b/app/disp_callbacks.c index cf9e5f282b..cae8fd9488 100644 --- a/app/disp_callbacks.c +++ b/app/disp_callbacks.c @@ -405,7 +405,11 @@ gdisplay_canvas_events (GtkWidget *canvas, if (mevent->is_hint) gdk_input_window_get_pointer (canvas->window, current_device, &tx, &ty, +#ifdef GTK_HAVE_SIX_VALUATORS + NULL, NULL, NULL, NULL, NULL); +#else /* !GTK_HAVE_SIX_VALUATORS */ NULL, NULL, NULL, NULL); +#endif /* GTK_HAVE_SIX_VALUATORS */ else { tx = mevent->x; @@ -487,8 +491,12 @@ gdisplay_canvas_events (GtkWidget *canvas, /* For all modifier keys: call the tools modifier_key_func */ if (active_tool && !gimage_is_empty (gdisp->gimage)) { - gdk_input_window_get_pointer (canvas->window, current_device, + gdk_input_window_get_pointer (canvas->window, current_device, +#ifdef GTK_HAVE_SIX_VALUATORS + &tx, &ty, NULL, NULL, NULL, NULL, NULL); +#else /* !GTK_HAVE_SIX_VALUATORS */ &tx, &ty, NULL, NULL, NULL, NULL); +#endif /* GTK_HAVE_SIX_VALUATORS */ (* active_tool->modifier_key_func) (active_tool, kevent, gdisp); return_val = TRUE; } @@ -509,8 +517,12 @@ gdisplay_canvas_events (GtkWidget *canvas, /* For all modifier keys: call the tools modifier_key_func */ if (active_tool && !gimage_is_empty (gdisp->gimage)) { - gdk_input_window_get_pointer (canvas->window, current_device, - &tx, &ty, NULL, NULL, NULL, NULL); + gdk_input_window_get_pointer (canvas->window, current_device, +#ifdef GTK_HAVE_SIX_VALUATORS + &tx, &ty, NULL, NULL, NULL, NULL, NULL); +#else /* !GTK_HAVE_SIX_VALUATORS */ + &tx, &ty, NULL, NULL, NULL, NULL); +#endif /* GTK_HAVE_SIX_VALUATORS */ (* active_tool->modifier_key_func) (active_tool, kevent, gdisp); return_val = TRUE; } diff --git a/app/display/gimpdisplay-callbacks.c b/app/display/gimpdisplay-callbacks.c index cf9e5f282b..cae8fd9488 100644 --- a/app/display/gimpdisplay-callbacks.c +++ b/app/display/gimpdisplay-callbacks.c @@ -405,7 +405,11 @@ gdisplay_canvas_events (GtkWidget *canvas, if (mevent->is_hint) gdk_input_window_get_pointer (canvas->window, current_device, &tx, &ty, +#ifdef GTK_HAVE_SIX_VALUATORS + NULL, NULL, NULL, NULL, NULL); +#else /* !GTK_HAVE_SIX_VALUATORS */ NULL, NULL, NULL, NULL); +#endif /* GTK_HAVE_SIX_VALUATORS */ else { tx = mevent->x; @@ -487,8 +491,12 @@ gdisplay_canvas_events (GtkWidget *canvas, /* For all modifier keys: call the tools modifier_key_func */ if (active_tool && !gimage_is_empty (gdisp->gimage)) { - gdk_input_window_get_pointer (canvas->window, current_device, + gdk_input_window_get_pointer (canvas->window, current_device, +#ifdef GTK_HAVE_SIX_VALUATORS + &tx, &ty, NULL, NULL, NULL, NULL, NULL); +#else /* !GTK_HAVE_SIX_VALUATORS */ &tx, &ty, NULL, NULL, NULL, NULL); +#endif /* GTK_HAVE_SIX_VALUATORS */ (* active_tool->modifier_key_func) (active_tool, kevent, gdisp); return_val = TRUE; } @@ -509,8 +517,12 @@ gdisplay_canvas_events (GtkWidget *canvas, /* For all modifier keys: call the tools modifier_key_func */ if (active_tool && !gimage_is_empty (gdisp->gimage)) { - gdk_input_window_get_pointer (canvas->window, current_device, - &tx, &ty, NULL, NULL, NULL, NULL); + gdk_input_window_get_pointer (canvas->window, current_device, +#ifdef GTK_HAVE_SIX_VALUATORS + &tx, &ty, NULL, NULL, NULL, NULL, NULL); +#else /* !GTK_HAVE_SIX_VALUATORS */ + &tx, &ty, NULL, NULL, NULL, NULL); +#endif /* GTK_HAVE_SIX_VALUATORS */ (* active_tool->modifier_key_func) (active_tool, kevent, gdisp); return_val = TRUE; } diff --git a/app/display/gimpdisplay-scroll.c b/app/display/gimpdisplay-scroll.c index 26322e6343..d692705c2f 100644 --- a/app/display/gimpdisplay-scroll.c +++ b/app/display/gimpdisplay-scroll.c @@ -116,7 +116,11 @@ scroll_to_pointer_position (GDisplay *gdisp, { gdk_input_window_get_pointer (gdisp->canvas->window, mevent->deviceid, &child_x, &child_y, +#ifdef GTK_HAVE_SIX_VALUATORS + NULL, NULL, NULL, NULL, NULL); +#else /* !GTK_HAVE_SIX_VALUATORS */ NULL, NULL, NULL, NULL); +#endif /* GTK_HAVE_SIX_VALUATORS */ if (child_x == mevent->x && child_y == mevent->y) /* Put this event back on the queue -- so it keeps scrolling */ diff --git a/app/display/gimpdisplayshell-callbacks.c b/app/display/gimpdisplayshell-callbacks.c index cf9e5f282b..cae8fd9488 100644 --- a/app/display/gimpdisplayshell-callbacks.c +++ b/app/display/gimpdisplayshell-callbacks.c @@ -405,7 +405,11 @@ gdisplay_canvas_events (GtkWidget *canvas, if (mevent->is_hint) gdk_input_window_get_pointer (canvas->window, current_device, &tx, &ty, +#ifdef GTK_HAVE_SIX_VALUATORS + NULL, NULL, NULL, NULL, NULL); +#else /* !GTK_HAVE_SIX_VALUATORS */ NULL, NULL, NULL, NULL); +#endif /* GTK_HAVE_SIX_VALUATORS */ else { tx = mevent->x; @@ -487,8 +491,12 @@ gdisplay_canvas_events (GtkWidget *canvas, /* For all modifier keys: call the tools modifier_key_func */ if (active_tool && !gimage_is_empty (gdisp->gimage)) { - gdk_input_window_get_pointer (canvas->window, current_device, + gdk_input_window_get_pointer (canvas->window, current_device, +#ifdef GTK_HAVE_SIX_VALUATORS + &tx, &ty, NULL, NULL, NULL, NULL, NULL); +#else /* !GTK_HAVE_SIX_VALUATORS */ &tx, &ty, NULL, NULL, NULL, NULL); +#endif /* GTK_HAVE_SIX_VALUATORS */ (* active_tool->modifier_key_func) (active_tool, kevent, gdisp); return_val = TRUE; } @@ -509,8 +517,12 @@ gdisplay_canvas_events (GtkWidget *canvas, /* For all modifier keys: call the tools modifier_key_func */ if (active_tool && !gimage_is_empty (gdisp->gimage)) { - gdk_input_window_get_pointer (canvas->window, current_device, - &tx, &ty, NULL, NULL, NULL, NULL); + gdk_input_window_get_pointer (canvas->window, current_device, +#ifdef GTK_HAVE_SIX_VALUATORS + &tx, &ty, NULL, NULL, NULL, NULL, NULL); +#else /* !GTK_HAVE_SIX_VALUATORS */ + &tx, &ty, NULL, NULL, NULL, NULL); +#endif /* GTK_HAVE_SIX_VALUATORS */ (* active_tool->modifier_key_func) (active_tool, kevent, gdisp); return_val = TRUE; } diff --git a/app/display/gimpdisplayshell-scroll.c b/app/display/gimpdisplayshell-scroll.c index 26322e6343..d692705c2f 100644 --- a/app/display/gimpdisplayshell-scroll.c +++ b/app/display/gimpdisplayshell-scroll.c @@ -116,7 +116,11 @@ scroll_to_pointer_position (GDisplay *gdisp, { gdk_input_window_get_pointer (gdisp->canvas->window, mevent->deviceid, &child_x, &child_y, +#ifdef GTK_HAVE_SIX_VALUATORS + NULL, NULL, NULL, NULL, NULL); +#else /* !GTK_HAVE_SIX_VALUATORS */ NULL, NULL, NULL, NULL); +#endif /* GTK_HAVE_SIX_VALUATORS */ if (child_x == mevent->x && child_y == mevent->y) /* Put this event back on the queue -- so it keeps scrolling */ diff --git a/app/gimprc.c b/app/gimprc.c index 6337fe6748..bc2659bddd 100644 --- a/app/gimprc.c +++ b/app/gimprc.c @@ -1900,6 +1900,10 @@ parse_device (gpointer val1p, axes[i] = GDK_AXIS_XTILT; else if (!strcmp ("ytilt", token_sym)) axes[i] = GDK_AXIS_YTILT; +#ifdef GTK_HAVE_SIX_VALUATORS + else if (!strcmp ("wheel", token_sym)) + axes[i] = GDK_AXIS_WHEEL; +#endif /* GTK_HAVE_SIX_VALUATORS */ else goto error; } diff --git a/app/gui/device-status-dialog.c b/app/gui/device-status-dialog.c index 8fbecda94c..10c667fccc 100644 --- a/app/gui/device-status-dialog.c +++ b/app/gui/device-status-dialog.c @@ -593,6 +593,11 @@ devices_write_rc_device (DeviceInfo *device_info, case GDK_AXIS_YTILT: axis_type = "ytilt"; break; +#ifdef GTK_HAVE_SIX_VALUATORS + case GDK_AXIS_WHEEL: + axis_type = "wheel"; + break; +#endif /* GTK_HAVE_SIX_VALUATORS */ } fprintf(fp, " %s",axis_type); } diff --git a/app/gui/input-dialog.c b/app/gui/input-dialog.c index 8fbecda94c..10c667fccc 100644 --- a/app/gui/input-dialog.c +++ b/app/gui/input-dialog.c @@ -593,6 +593,11 @@ devices_write_rc_device (DeviceInfo *device_info, case GDK_AXIS_YTILT: axis_type = "ytilt"; break; +#ifdef GTK_HAVE_SIX_VALUATORS + case GDK_AXIS_WHEEL: + axis_type = "wheel"; + break; +#endif /* GTK_HAVE_SIX_VALUATORS */ } fprintf(fp, " %s",axis_type); } diff --git a/app/paint_core.c b/app/paint_core.c index 109a4f9e75..a0fe9e030f 100644 --- a/app/paint_core.c +++ b/app/paint_core.c @@ -187,6 +187,9 @@ paint_core_button_press (Tool *tool, paint_core->curpressure = bevent->pressure; paint_core->curxtilt = bevent->xtilt; paint_core->curytilt = bevent->ytilt; +#ifdef GTK_HAVE_SIX_VALUATORS + paint_core->curwheel = bevent->wheel; +#endif /* GTK_HAVE_SIX_VALUATORS */ paint_core->state = bevent->state; if (gdisp_ptr != tool->gdisp_ptr) @@ -204,6 +207,9 @@ paint_core_button_press (Tool *tool, paint_core->startpressure = paint_core->lastpressure = paint_core->curpressure; paint_core->startytilt = paint_core->lastytilt = paint_core->curytilt; paint_core->startxtilt = paint_core->lastxtilt = paint_core->curxtilt; +#ifdef GTK_HAVE_SIX_VALUATORS + paint_core->startwheel = paint_core->lastwheel = paint_core->curwheel; +#endif /* GTK_HAVE_SIX_VALUATORS */ } /* If shift is down and this is not the first paint @@ -217,6 +223,9 @@ paint_core_button_press (Tool *tool, paint_core->startpressure = paint_core->lastpressure; paint_core->startxtilt = paint_core->lastxtilt; paint_core->startytilt = paint_core->lastytilt; +#ifdef GTK_HAVE_SIX_VALUATORS + paint_core->startwheel = paint_core->lastwheel; +#endif /* GTK_HAVE_SIX_VALUATORS */ /* restrict to horizontal/vertical lines, if modifiers are pressed */ if (bevent->state & GDK_MOD1_MASK) @@ -281,6 +290,9 @@ paint_core_button_press (Tool *tool, paint_core->lastpressure = paint_core->curpressure; paint_core->lastxtilt = paint_core->curxtilt; paint_core->lastytilt = paint_core->curytilt; +#ifdef GTK_HAVE_SIX_VALUATORS + paint_core->lastwheel = paint_core->curwheel; +#endif /* GTK_HAVE_SIX_VALUATORS */ } else { @@ -361,6 +373,9 @@ paint_core_motion (Tool *tool, paint_core->curpressure = mevent->pressure; paint_core->curxtilt = mevent->xtilt; paint_core->curytilt = mevent->ytilt; +#ifdef GTK_HAVE_SIX_VALUATORS + paint_core->curwheel = mevent->wheel; +#endif /* GTK_HAVE_SIX_VALUATORS */ paint_core->state = mevent->state; paint_core_interpolate (paint_core, gimage_active_drawable (gdisp->gimage)); @@ -372,6 +387,9 @@ paint_core_motion (Tool *tool, paint_core->lastpressure = paint_core->curpressure; paint_core->lastxtilt = paint_core->curxtilt; paint_core->lastytilt = paint_core->curytilt; +#ifdef GTK_HAVE_SIX_VALUATORS + paint_core->lastwheel = paint_core->curwheel; +#endif /* GTK_HAVE_SIX_VALUATORS */ } void @@ -635,6 +653,7 @@ paint_core_init (PaintCore *paint_core, paint_core->startpressure = paint_core->lastpressure = paint_core->curpressure = 0.5; paint_core->startxtilt = paint_core->lastxtilt = paint_core->curxtilt = 0; paint_core->startytilt = paint_core->lastytilt = paint_core->curytilt = 0; + paint_core->startwheel = paint_core->lastwheel = paint_core->curwheel = 0.5; } /* Each buffer is the same size as the maximum bounds of the active brush... */ @@ -764,7 +783,11 @@ paint_core_interpolate (PaintCore *paint_core, { double n; vector2d delta; +#ifdef GTK_HAVE_SIX_VALUATORS + double dpressure, dxtilt, dytilt, dwheel; +#else /* !GTK_HAVE_SIX_VALUATORS */ double dpressure, dxtilt, dytilt; +#endif /* GTK_HAVE_SIX_VALUATORS */ double left; double t; double initial; @@ -777,9 +800,16 @@ paint_core_interpolate (PaintCore *paint_core, dpressure = paint_core->curpressure - paint_core->lastpressure; dxtilt = paint_core->curxtilt - paint_core->lastxtilt; dytilt = paint_core->curytilt - paint_core->lastytilt; +#ifdef GTK_HAVE_SIX_VALUATORS + dwheel = paint_core->curwheel - paint_core->lastwheel; +#endif /* GTK_HAVE_SIX_VALUATORS */ /* return if there has been no motion */ +#ifdef GTK_HAVE_SIX_VALUATORS + if (!delta.x && !delta.y && !dpressure && !dxtilt && !dytilt && !dwheel) +#else /* !GTK_HAVE_SIX_VALUATORS */ if (!delta.x && !delta.y && !dpressure && !dxtilt && !dytilt) +#endif /* GTK_HAVE_SIX_VALUATORS */ return; /* calculate the distance traveled in the coordinate space of the brush */ @@ -810,6 +840,9 @@ paint_core_interpolate (PaintCore *paint_core, paint_core->curpressure = paint_core->lastpressure + dpressure * t; paint_core->curxtilt = paint_core->lastxtilt + dxtilt * t; paint_core->curytilt = paint_core->lastytilt + dytilt * t; +#ifdef GTK_HAVE_SIX_VALUATORS + paint_core->curwheel = paint_core->lastwheel + dwheel * t; +#endif /* GTK_HAVE_SIX_VALUATORS */ if (paint_core->flags & TOOL_CAN_HANDLE_CHANGING_BRUSH) paint_core->brush = (* GIMP_BRUSH_CLASS (GTK_OBJECT (paint_core->brush) @@ -824,6 +857,9 @@ paint_core_interpolate (PaintCore *paint_core, paint_core->curpressure = paint_core->lastpressure + dpressure; paint_core->curxtilt = paint_core->lastxtilt + dxtilt; paint_core->curytilt = paint_core->lastytilt + dytilt; +#ifdef GTK_HAVE_SIX_VALUATORS + paint_core->curwheel = paint_core->lastwheel + dwheel; +#endif /* GTK_HAVE_SIX_VALUATORS */ } void @@ -853,6 +889,9 @@ paint_core_finish (PaintCore *paint_core, pu->lastpressure = paint_core->startpressure; pu->lastxtilt = paint_core->startxtilt; pu->lastytilt = paint_core->startytilt; +#ifdef GTK_HAVE_SIX_VALUATORS + pu->lastwheel = paint_core->startwheel; +#endif /* GTK_HAVE_SIX_VALUATORS */ /* Push a paint undo */ undo_push_paint (gimage, pu); diff --git a/app/paint_core.h b/app/paint_core.h index 342d3b16f5..d99df5c042 100644 --- a/app/paint_core.h +++ b/app/paint_core.h @@ -46,21 +46,30 @@ struct _paint_core double startx; /* starting x coord */ double starty; /* starting y coord */ - double startpressure; /* starting pressure */ - double startxtilt; /* starting xtilt */ - double startytilt; /* starting ytilt */ + double startpressure; /* starting pressure */ + double startxtilt; /* starting xtilt */ + double startytilt; /* starting ytilt */ +#ifdef GTK_HAVE_SIX_VALUATORS + double startwheel; /* starting wheel */ +#endif /* GTK_HAVE_SIX_VALUATORS */ double curx; /* current x coord */ double cury; /* current y coord */ double curpressure; /* current pressure */ double curxtilt; /* current xtilt */ double curytilt; /* current ytilt */ +#ifdef GTK_HAVE_SIX_VALUATORS + double curwheel; /* current wheel */ +#endif /* GTK_HAVE_SIX_VALUATORS */ double lastx; /* last x coord */ double lasty; /* last y coord */ double lastpressure; /* last pressure */ double lastxtilt; /* last xtilt */ - double lastytilt; /* last ytilt */ + double lastytilt; /* last ytilt */ +#ifdef GTK_HAVE_SIX_VALUATORS + double lastwheel; /* last wheel */ +#endif /* GTK_HAVE_SIX_VALUATORS */ int state; /* state of buttons and keys */ @@ -94,6 +103,9 @@ struct _paint_undo double lastpressure; double lastxtilt; double lastytilt; +#ifdef GTK_HAVE_SIX_VALUATORS + double lastwheel; +#endif /* GTK_HAVE_SIX_VALUATORS */ }; /* paint tool action functions */ diff --git a/app/scroll.c b/app/scroll.c index 26322e6343..d692705c2f 100644 --- a/app/scroll.c +++ b/app/scroll.c @@ -116,7 +116,11 @@ scroll_to_pointer_position (GDisplay *gdisp, { gdk_input_window_get_pointer (gdisp->canvas->window, mevent->deviceid, &child_x, &child_y, +#ifdef GTK_HAVE_SIX_VALUATORS + NULL, NULL, NULL, NULL, NULL); +#else /* !GTK_HAVE_SIX_VALUATORS */ NULL, NULL, NULL, NULL); +#endif /* GTK_HAVE_SIX_VALUATORS */ if (child_x == mevent->x && child_y == mevent->y) /* Put this event back on the queue -- so it keeps scrolling */ diff --git a/app/tools/paint_core.c b/app/tools/paint_core.c index 109a4f9e75..a0fe9e030f 100644 --- a/app/tools/paint_core.c +++ b/app/tools/paint_core.c @@ -187,6 +187,9 @@ paint_core_button_press (Tool *tool, paint_core->curpressure = bevent->pressure; paint_core->curxtilt = bevent->xtilt; paint_core->curytilt = bevent->ytilt; +#ifdef GTK_HAVE_SIX_VALUATORS + paint_core->curwheel = bevent->wheel; +#endif /* GTK_HAVE_SIX_VALUATORS */ paint_core->state = bevent->state; if (gdisp_ptr != tool->gdisp_ptr) @@ -204,6 +207,9 @@ paint_core_button_press (Tool *tool, paint_core->startpressure = paint_core->lastpressure = paint_core->curpressure; paint_core->startytilt = paint_core->lastytilt = paint_core->curytilt; paint_core->startxtilt = paint_core->lastxtilt = paint_core->curxtilt; +#ifdef GTK_HAVE_SIX_VALUATORS + paint_core->startwheel = paint_core->lastwheel = paint_core->curwheel; +#endif /* GTK_HAVE_SIX_VALUATORS */ } /* If shift is down and this is not the first paint @@ -217,6 +223,9 @@ paint_core_button_press (Tool *tool, paint_core->startpressure = paint_core->lastpressure; paint_core->startxtilt = paint_core->lastxtilt; paint_core->startytilt = paint_core->lastytilt; +#ifdef GTK_HAVE_SIX_VALUATORS + paint_core->startwheel = paint_core->lastwheel; +#endif /* GTK_HAVE_SIX_VALUATORS */ /* restrict to horizontal/vertical lines, if modifiers are pressed */ if (bevent->state & GDK_MOD1_MASK) @@ -281,6 +290,9 @@ paint_core_button_press (Tool *tool, paint_core->lastpressure = paint_core->curpressure; paint_core->lastxtilt = paint_core->curxtilt; paint_core->lastytilt = paint_core->curytilt; +#ifdef GTK_HAVE_SIX_VALUATORS + paint_core->lastwheel = paint_core->curwheel; +#endif /* GTK_HAVE_SIX_VALUATORS */ } else { @@ -361,6 +373,9 @@ paint_core_motion (Tool *tool, paint_core->curpressure = mevent->pressure; paint_core->curxtilt = mevent->xtilt; paint_core->curytilt = mevent->ytilt; +#ifdef GTK_HAVE_SIX_VALUATORS + paint_core->curwheel = mevent->wheel; +#endif /* GTK_HAVE_SIX_VALUATORS */ paint_core->state = mevent->state; paint_core_interpolate (paint_core, gimage_active_drawable (gdisp->gimage)); @@ -372,6 +387,9 @@ paint_core_motion (Tool *tool, paint_core->lastpressure = paint_core->curpressure; paint_core->lastxtilt = paint_core->curxtilt; paint_core->lastytilt = paint_core->curytilt; +#ifdef GTK_HAVE_SIX_VALUATORS + paint_core->lastwheel = paint_core->curwheel; +#endif /* GTK_HAVE_SIX_VALUATORS */ } void @@ -635,6 +653,7 @@ paint_core_init (PaintCore *paint_core, paint_core->startpressure = paint_core->lastpressure = paint_core->curpressure = 0.5; paint_core->startxtilt = paint_core->lastxtilt = paint_core->curxtilt = 0; paint_core->startytilt = paint_core->lastytilt = paint_core->curytilt = 0; + paint_core->startwheel = paint_core->lastwheel = paint_core->curwheel = 0.5; } /* Each buffer is the same size as the maximum bounds of the active brush... */ @@ -764,7 +783,11 @@ paint_core_interpolate (PaintCore *paint_core, { double n; vector2d delta; +#ifdef GTK_HAVE_SIX_VALUATORS + double dpressure, dxtilt, dytilt, dwheel; +#else /* !GTK_HAVE_SIX_VALUATORS */ double dpressure, dxtilt, dytilt; +#endif /* GTK_HAVE_SIX_VALUATORS */ double left; double t; double initial; @@ -777,9 +800,16 @@ paint_core_interpolate (PaintCore *paint_core, dpressure = paint_core->curpressure - paint_core->lastpressure; dxtilt = paint_core->curxtilt - paint_core->lastxtilt; dytilt = paint_core->curytilt - paint_core->lastytilt; +#ifdef GTK_HAVE_SIX_VALUATORS + dwheel = paint_core->curwheel - paint_core->lastwheel; +#endif /* GTK_HAVE_SIX_VALUATORS */ /* return if there has been no motion */ +#ifdef GTK_HAVE_SIX_VALUATORS + if (!delta.x && !delta.y && !dpressure && !dxtilt && !dytilt && !dwheel) +#else /* !GTK_HAVE_SIX_VALUATORS */ if (!delta.x && !delta.y && !dpressure && !dxtilt && !dytilt) +#endif /* GTK_HAVE_SIX_VALUATORS */ return; /* calculate the distance traveled in the coordinate space of the brush */ @@ -810,6 +840,9 @@ paint_core_interpolate (PaintCore *paint_core, paint_core->curpressure = paint_core->lastpressure + dpressure * t; paint_core->curxtilt = paint_core->lastxtilt + dxtilt * t; paint_core->curytilt = paint_core->lastytilt + dytilt * t; +#ifdef GTK_HAVE_SIX_VALUATORS + paint_core->curwheel = paint_core->lastwheel + dwheel * t; +#endif /* GTK_HAVE_SIX_VALUATORS */ if (paint_core->flags & TOOL_CAN_HANDLE_CHANGING_BRUSH) paint_core->brush = (* GIMP_BRUSH_CLASS (GTK_OBJECT (paint_core->brush) @@ -824,6 +857,9 @@ paint_core_interpolate (PaintCore *paint_core, paint_core->curpressure = paint_core->lastpressure + dpressure; paint_core->curxtilt = paint_core->lastxtilt + dxtilt; paint_core->curytilt = paint_core->lastytilt + dytilt; +#ifdef GTK_HAVE_SIX_VALUATORS + paint_core->curwheel = paint_core->lastwheel + dwheel; +#endif /* GTK_HAVE_SIX_VALUATORS */ } void @@ -853,6 +889,9 @@ paint_core_finish (PaintCore *paint_core, pu->lastpressure = paint_core->startpressure; pu->lastxtilt = paint_core->startxtilt; pu->lastytilt = paint_core->startytilt; +#ifdef GTK_HAVE_SIX_VALUATORS + pu->lastwheel = paint_core->startwheel; +#endif /* GTK_HAVE_SIX_VALUATORS */ /* Push a paint undo */ undo_push_paint (gimage, pu); diff --git a/app/tools/paint_core.h b/app/tools/paint_core.h index 342d3b16f5..d99df5c042 100644 --- a/app/tools/paint_core.h +++ b/app/tools/paint_core.h @@ -46,21 +46,30 @@ struct _paint_core double startx; /* starting x coord */ double starty; /* starting y coord */ - double startpressure; /* starting pressure */ - double startxtilt; /* starting xtilt */ - double startytilt; /* starting ytilt */ + double startpressure; /* starting pressure */ + double startxtilt; /* starting xtilt */ + double startytilt; /* starting ytilt */ +#ifdef GTK_HAVE_SIX_VALUATORS + double startwheel; /* starting wheel */ +#endif /* GTK_HAVE_SIX_VALUATORS */ double curx; /* current x coord */ double cury; /* current y coord */ double curpressure; /* current pressure */ double curxtilt; /* current xtilt */ double curytilt; /* current ytilt */ +#ifdef GTK_HAVE_SIX_VALUATORS + double curwheel; /* current wheel */ +#endif /* GTK_HAVE_SIX_VALUATORS */ double lastx; /* last x coord */ double lasty; /* last y coord */ double lastpressure; /* last pressure */ double lastxtilt; /* last xtilt */ - double lastytilt; /* last ytilt */ + double lastytilt; /* last ytilt */ +#ifdef GTK_HAVE_SIX_VALUATORS + double lastwheel; /* last wheel */ +#endif /* GTK_HAVE_SIX_VALUATORS */ int state; /* state of buttons and keys */ @@ -94,6 +103,9 @@ struct _paint_undo double lastpressure; double lastxtilt; double lastytilt; +#ifdef GTK_HAVE_SIX_VALUATORS + double lastwheel; +#endif /* GTK_HAVE_SIX_VALUATORS */ }; /* paint tool action functions */ diff --git a/app/widgets/gimpdeviceinfo.c b/app/widgets/gimpdeviceinfo.c index 8fbecda94c..10c667fccc 100644 --- a/app/widgets/gimpdeviceinfo.c +++ b/app/widgets/gimpdeviceinfo.c @@ -593,6 +593,11 @@ devices_write_rc_device (DeviceInfo *device_info, case GDK_AXIS_YTILT: axis_type = "ytilt"; break; +#ifdef GTK_HAVE_SIX_VALUATORS + case GDK_AXIS_WHEEL: + axis_type = "wheel"; + break; +#endif /* GTK_HAVE_SIX_VALUATORS */ } fprintf(fp, " %s",axis_type); } diff --git a/app/widgets/gimpdevices.c b/app/widgets/gimpdevices.c index 8fbecda94c..10c667fccc 100644 --- a/app/widgets/gimpdevices.c +++ b/app/widgets/gimpdevices.c @@ -593,6 +593,11 @@ devices_write_rc_device (DeviceInfo *device_info, case GDK_AXIS_YTILT: axis_type = "ytilt"; break; +#ifdef GTK_HAVE_SIX_VALUATORS + case GDK_AXIS_WHEEL: + axis_type = "wheel"; + break; +#endif /* GTK_HAVE_SIX_VALUATORS */ } fprintf(fp, " %s",axis_type); } diff --git a/modules/colorsel_water.c b/modules/colorsel_water.c index a012f0a3ae..c777f975c9 100644 --- a/modules/colorsel_water.c +++ b/modules/colorsel_water.c @@ -396,7 +396,11 @@ motion_notify_event (GtkWidget *widget, GdkEventMotion *event) { if (event->is_hint) gdk_input_window_get_pointer (event->window, event->deviceid, +#ifdef GTK_HAVE_SIX_VALUATORS + NULL, NULL, NULL, NULL, NULL, NULL, NULL); +#else /* !GTK_HAVE_SIX_VALUATORS */ NULL, NULL, NULL, NULL, NULL, NULL); +#endif /* GTK_HAVE_SIX_VALUATORS */ draw_brush (widget, erase, event->x, event->y, event->pressure); } @@ -405,7 +409,11 @@ motion_notify_event (GtkWidget *widget, GdkEventMotion *event) { gdk_input_window_get_pointer (event->window, event->deviceid, &event->x, &event->y, +#ifdef GTK_HAVE_SIX_VALUATORS + NULL, NULL, NULL, NULL, NULL); +#else /* !GTK_HAVE_SIX_VALUATORS */ NULL, NULL, NULL, NULL); +#endif /* GTK_HAVE_SIX_VALUATORS */ } return TRUE; diff --git a/patch_xinput_airbrush b/patch_xinput_airbrush new file mode 100644 index 0000000000..62fcde793a --- /dev/null +++ b/patch_xinput_airbrush @@ -0,0 +1,347 @@ +--- gdk/gdk.h Wed Feb 24 11:14:55 1999 ++++ gdk/gdk.h Tue Jul 6 17:45:19 1999 +@@ -840,6 +840,7 @@ + gdouble *pressure, + gdouble *xtilt, + gdouble *ytilt, ++ gdouble *wheel, + GdkModifierType *mask); + + GdkTimeCoord *gdk_input_motion_events (GdkWindow *window, +--- gdk/gdkinput.c Wed Feb 24 11:14:55 1999 ++++ gdk/gdkinput.c Tue Jul 6 18:09:49 1999 +@@ -153,6 +153,7 @@ + coords[i].pressure = 0.5; + coords[i].xtilt = 0.0; + coords[i].ytilt = 0.0; ++ coords[i].wheel = 0.5; + } + + XFree (xcoords); +@@ -345,9 +346,10 @@ + gdouble *pressure, + gdouble *xtilt, + gdouble *ytilt, ++ gdouble *wheel, + GdkModifierType *mask) + { + if (gdk_input_vtable.get_pointer) + gdk_input_vtable.get_pointer (window, deviceid, x, y, pressure, +- xtilt, ytilt, mask); ++ xtilt, ytilt, wheel, mask); + } +--- gdk/gdkinput.h Wed Feb 24 11:14:56 1999 ++++ gdk/gdkinput.h Tue Jul 6 17:57:32 1999 +@@ -56,6 +56,7 @@ + gdouble *pressure, + gdouble *xtilt, + gdouble *ytilt, ++ gdouble *wheel, + GdkModifierType *mask); + gint (*grab_pointer) (GdkWindow * window, + gint owner_events, +--- gdk/gdkinputcommon.h Wed Feb 24 11:14:56 1999 ++++ gdk/gdkinputcommon.h Tue Jul 6 18:22:13 1999 +@@ -45,7 +45,8 @@ + gint *axis_data, + gdouble *x, gdouble *y, + gdouble *pressure, +- gdouble *xtilt, gdouble *ytilt); ++ gdouble *xtilt, gdouble *ytilt, ++ gdouble *wheel); + static guint gdk_input_translate_state(guint state, guint device_state); + static gint gdk_input_common_init(gint include_core); + static gint gdk_input_common_other_event (GdkEvent *event, +@@ -65,6 +66,7 @@ + gdouble *pressure, + gdouble *xtilt, + gdouble *ytilt, ++ gdouble *wheel, + GdkModifierType *mask); + + #define GDK_MAX_DEVICE_CLASSES 13 +@@ -237,6 +239,8 @@ + gdkdev->info.axes[j++] = GDK_AXIS_XTILT; + if (jnum_axes) + gdkdev->info.axes[j++] = GDK_AXIS_YTILT; ++ if (jnum_axes) ++ gdkdev->info.axes[j++] = GDK_AXIS_WHEEL; + + /* set up reverse lookup on axis use */ + for (j=GDK_AXIS_IGNORE;jaxis_for_use[GDK_AXIS_PRESSURE]; + xtilt_axis = gdkdev->axis_for_use[GDK_AXIS_XTILT]; + ytilt_axis = gdkdev->axis_for_use[GDK_AXIS_YTILT]; ++ wheel_axis = gdkdev->axis_for_use[GDK_AXIS_WHEEL]; + + device_width = gdkdev->axes[x_axis].max_value - + gdkdev->axes[x_axis].min_value; +@@ -568,6 +573,16 @@ + else + *ytilt = 0; + } ++ if (wheel) ++ { ++ if (wheel_axis != -1) ++ *wheel = ((double)axis_data[wheel_axis] ++ - gdkdev->axes[wheel_axis].min_value) ++ / (gdkdev->axes[wheel_axis].max_value ++ - gdkdev->axes[wheel_axis].min_value); ++ else ++ *wheel = 0.5; ++ } + } + + /* combine the state of the core device and the device state +@@ -611,7 +626,8 @@ + &event->button.x,&event->button.y, + &event->button.pressure, + &event->button.xtilt, +- &event->button.ytilt); ++ &event->button.ytilt, ++ &event->button.wheel); + event->button.state = gdk_input_translate_state(xdbe->state,xdbe->device_state); + event->button.button = xdbe->button; + +@@ -694,7 +710,8 @@ + &event->motion.x,&event->motion.y, + &event->motion.pressure, + &event->motion.xtilt, +- &event->motion.ytilt); ++ &event->motion.ytilt, ++ &event->motion.wheel); + + event->motion.type = GDK_MOTION_NOTIFY; + event->motion.window = input_window->window; +@@ -809,7 +826,8 @@ + device_coords[i].data, + &coords[i].x, &coords[i].y, + &coords[i].pressure, +- &coords[i].xtilt, &coords[i].ytilt); ++ &coords[i].xtilt, &coords[i].ytilt, ++ &coords[i].wheel); + } + XFreeDeviceMotionEvents (device_coords); + +@@ -827,6 +845,7 @@ + gdouble *pressure, + gdouble *xtilt, + gdouble *ytilt, ++ gdouble *wheel, + GdkModifierType *mask) + { + GdkDevicePrivate *gdkdev; +@@ -846,6 +865,7 @@ + if (pressure) *pressure = 0.5; + if (xtilt) *xtilt = 0; + if (ytilt) *ytilt = 0; ++ if (wheel) *wheel = 0.5; + } + else + { +@@ -868,8 +888,10 @@ + case ValuatorClass: + gdk_input_translate_coordinates (gdkdev, input_window, + ((XValuatorState *)input_class)->valuators, +- x, y, pressure, +- xtilt, ytilt); ++ x, y, ++ pressure, ++ xtilt, ytilt, ++ wheel); + + + break; +--- gdk/gdkinputgxi.h Wed Feb 24 11:14:56 1999 ++++ gdk/gdkinputgxi.h Tue Jul 6 18:03:42 1999 +@@ -64,6 +64,7 @@ + gdouble *pressure, + gdouble *xtilt, + gdouble *ytilt, ++ gdouble *wheel, + GdkModifierType *mask); + static gint gdk_input_gxi_grab_pointer (GdkWindow * window, + gint owner_events, +@@ -554,6 +555,7 @@ + gdouble *pressure, + gdouble *xtilt, + gdouble *ytilt, ++ gdouble *wheel, + GdkModifierType *mask) + { + GdkDevicePrivate *gdkdev; +@@ -563,10 +565,10 @@ + + if (gdkdev == gdk_input_core_pointer) + gdk_input_common_get_pointer (window, GDK_CORE_POINTER, x, y, +- pressure, xtilt, ytilt, mask); ++ pressure, xtilt, ytilt, wheel, mask); + else + gdk_input_common_get_pointer (window, deviceid, x, y, +- pressure, xtilt, ytilt, mask); ++ pressure, xtilt, ytilt, wheel, mask); + } + + static GdkTimeCoord * +--- gdk/gdkinputnone.h Wed Feb 24 11:14:56 1999 ++++ gdk/gdkinputnone.h Tue Jul 6 18:02:14 1999 +@@ -33,6 +33,7 @@ + gdouble *pressure, + gdouble *xtilt, + gdouble *ytilt, ++ gdouble *wheel, + GdkModifierType *mask); + + void +@@ -65,6 +66,7 @@ + gdouble *pressure, + gdouble *xtilt, + gdouble *ytilt, ++ gdouble *wheel, + GdkModifierType *mask) + { + gint x_int, y_int; +@@ -76,6 +78,7 @@ + if (pressure) *pressure = 0.5; + if (xtilt) *xtilt = 0; + if (ytilt) *ytilt = 0; ++ if (wheel) *wheel = 0.5; + } + + #endif /* XINPUT_NONE */ +--- gdk/gdktypes.h Wed Feb 24 11:14:56 1999 ++++ gdk/gdktypes.h Tue Jul 6 18:11:37 1999 +@@ -577,6 +577,7 @@ + GDK_AXIS_PRESSURE, + GDK_AXIS_XTILT, + GDK_AXIS_YTILT, ++ GDK_AXIS_WHEEL, + GDK_AXIS_LAST + } GdkAxisUse; + +@@ -1001,6 +1002,7 @@ + gdouble pressure; + gdouble xtilt; + gdouble ytilt; ++ gdouble wheel; + }; + + /* Structure that holds information about a drag in progress. +@@ -1073,6 +1075,7 @@ + gdouble pressure; + gdouble xtilt; + gdouble ytilt; ++ gdouble wheel; + guint state; + gint16 is_hint; + GdkInputSource source; +@@ -1091,6 +1094,7 @@ + gdouble pressure; + gdouble xtilt; + gdouble ytilt; ++ gdouble wheel; + guint state; + guint button; + GdkInputSource source; +--- gtk/gtkinputdialog.c Wed Feb 24 11:15:09 1999 ++++ gtk/gtkinputdialog.c Tue Jul 6 18:37:59 1999 +@@ -70,10 +70,10 @@ + + + #define AXIS_LIST_WIDTH 160 +-#define AXIS_LIST_HEIGHT 175 ++#define AXIS_LIST_HEIGHT 195 + + #define KEYS_LIST_WIDTH 200 +-#define KEYS_LIST_HEIGHT 175 ++#define KEYS_LIST_HEIGHT 195 + + /* Forward declarations */ + +@@ -501,7 +501,8 @@ + N_("Y"), + N_("Pressure"), + N_("X Tilt"), +- N_("Y Tilt") ++ N_("Y Tilt"), ++ N_("Wheel") + }; + + int i,j; +--- gtk/testinput.c Wed Feb 24 11:15:18 1999 ++++ gtk/testinput.c Tue Jul 6 19:13:50 1999 +@@ -236,7 +236,7 @@ + { + if (event->is_hint) + gdk_input_window_get_pointer (event->window, event->deviceid, +- NULL, NULL, NULL, NULL, NULL, NULL); ++ NULL, NULL, NULL, NULL, NULL, NULL, NULL); + draw_brush (widget, event->source, event->x, event->y, + event->pressure); + } +@@ -245,7 +245,7 @@ + { + gdk_input_window_get_pointer (event->window, event->deviceid, + &event->x, &event->y, +- NULL, NULL, NULL, NULL); ++ NULL, NULL, NULL, NULL, NULL); + } + + update_cursor (widget, event->x, event->y); +--- gtk/gtkfeatures.h Sat Sep 4 11:13:32 1999 ++++ gtk/gtkfeatures.h Sat Sep 4 11:35:21 1999 +@@ -115,6 +115,13 @@ + */ + #define GTK_HAVE_FEATURES_1_1_14 1-1-14 + ++/* Gtk+ patched to enable the ++ * sixth valuator present in ++ * the new xf86Wacom driver. ++ */ ++ ++#define GTK_HAVE_SIX_VALUATORS 1 ++ + #ifdef __cplusplus + } + #endif /* __cplusplus */ +--- ../../gtk+-1.2.4/gdk/gdkevents.c Mon Aug 23 21:40:31 1999 ++++ gdk/gdkevents.c Sat Sep 4 11:44:28 1999 +@@ -1213,6 +1213,7 @@ + event->button.pressure = 0.5; + event->button.xtilt = 0; + event->button.ytilt = 0; ++ event->button.wheel = 0.5; + event->button.state = (GdkModifierType) xevent->xbutton.state; + event->button.button = xevent->xbutton.button; + event->button.source = GDK_SOURCE_MOUSE; +@@ -1283,6 +1284,7 @@ + event->button.pressure = 0.5; + event->button.xtilt = 0; + event->button.ytilt = 0; ++ event->button.wheel = 0.5; + event->button.state = (GdkModifierType) xevent->xbutton.state; + event->button.button = xevent->xbutton.button; + event->button.source = GDK_SOURCE_MOUSE; +@@ -1317,6 +1319,7 @@ + event->motion.pressure = 0.5; + event->motion.xtilt = 0; + event->motion.ytilt = 0; ++ event->button.wheel = 0.5; + event->motion.state = (GdkModifierType) xevent->xmotion.state; + event->motion.is_hint = xevent->xmotion.is_hint; + event->motion.source = GDK_SOURCE_MOUSE;