Commit 0f1da428 authored by Olof S Kylander/GIMP's avatar Olof S Kylander/GIMP

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+.
parent adfadca1
Sat Sep 4 16:31:50 CEST 1999 Olof S Kylander <olof@frozenriver.com>
* 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 <yosh@gimp.org>
* app/gtkwrapbox.[ch]
......
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
......@@ -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);
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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 */
......
......@@ -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;
}
......
......@@ -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 */
......
......@@ -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;
}
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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 */
......
......@@ -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 */
......
......@@ -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);
......
......@@ -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 */
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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;
......
--- 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);