--- gimp-2.4.3-/app/display/gimpdisplayshell-callbacks.c Mon Jan 28 06:14:45 2008 +++ gimp-painter--2.4.3/app/display/gimpdisplayshell-callbacks.c Mon Jan 28 07:00:23 2008 @@ -79,9 +79,6 @@ #include "gimp-intl.h" -#define DEFAULT_EVENT_SMOOTHING 0.7 - - /* #define DEBUG_TOOL_EVENTS */ #ifdef DEBUG_TOOL_EVENTS @@ -91,6 +88,9 @@ #endif +#define DEFAULT_EVENT_SMOOTHING 0.7 +#define DEFAULT_EVENT_FILTER 0.5 + /* local function prototypes */ static void gimp_display_shell_vscrollbar_update (GtkAdjustment *adjustment, @@ -608,18 +608,18 @@ GdkEvent *event, GimpDisplayShell *shell) { - GimpDisplay *display; - GimpImage *image; - Gimp *gimp; - GdkDisplay *gdk_display; - GimpTool *active_tool; - GimpCoords display_coords; - GimpCoords image_coords; - GdkModifierType state; - guint32 time; - gboolean device_changed = FALSE; - gboolean return_val = FALSE; - gboolean update_sw_cursor = FALSE; + GimpDisplay *display; + GimpImage *image; + Gimp *gimp; + GdkDisplay *gdk_display; + GimpTool *active_tool; + GimpCoords display_coords; + GimpCoords image_coords; + GdkModifierType state; + guint32 time; + gboolean device_changed = FALSE; + gboolean return_val = FALSE; + gboolean update_sw_cursor = FALSE; g_return_val_if_fail (GTK_WIDGET_REALIZED (canvas), FALSE); @@ -1190,7 +1190,7 @@ GdkTimeCoord **history_events; gint n_history_events; - /* if the first mouse button is down, check for automatic + /* if the first mouse button is down, check for automatic * scrolling... */ if ((mevent->x < 0 || @@ -1252,6 +1252,7 @@ if (gimp_display_shell_eval_event (shell, &image_coords, DEFAULT_EVENT_SMOOTHING, + DEFAULT_EVENT_FILTER, history_events[i]->time)) { tool_manager_motion_active (gimp, @@ -1273,6 +1274,7 @@ if (gimp_display_shell_eval_event (shell, &image_coords, DEFAULT_EVENT_SMOOTHING, + DEFAULT_EVENT_FILTER, time)) { tool_manager_motion_active (gimp, @@ -1293,7 +1295,11 @@ /* Early removal of useless events saves CPU time. * Smoothing is 0.0 here for coasting. */ - if (gimp_display_shell_eval_event (shell, &image_coords, 0.0, time)) + if (gimp_display_shell_eval_event (shell, + &image_coords, + 0.0, + DEFAULT_EVENT_FILTER, + time)) { tool_manager_oper_update_active (gimp, &image_coords, state, --- gimp-2.4.3-/app/display/gimpdisplayshell-coords.c Mon Jan 28 06:14:45 2008 +++ gimp-painter--2.4.3/app/display/gimpdisplayshell-coords.c Mon Jan 28 06:58:36 2008 @@ -210,6 +210,7 @@ gimp_display_shell_eval_event (GimpDisplayShell *shell, GimpCoords *coords, gdouble inertia_factor, + gdouble filter_treshhold, guint32 time) { const gdouble smooth_factor = 0.3; @@ -230,11 +231,11 @@ gdouble dx = coords->delta_x = shell->last_coords.x - coords->x; gdouble dy = coords->delta_y = shell->last_coords.y - coords->y; - /* Events with distances less than 1 in either motion direction - * are not worth handling. + /* Events with distances less than the filter_threshold are not + worth handling. */ - if (fabs (dx) < 1.0 && fabs (dy) < 1.0) - return FALSE; + if (fabs (dx) < filter_treshhold && fabs (dy) < filter_treshhold) + return TRUE; /* This return value is for workaround against G-Pen's malfunction */ coords->delta_time = thistime - shell->last_disp_motion_time; coords->delta_time = (shell->last_coords.delta_time * (1 - smooth_factor) @@ -260,11 +261,11 @@ coords->velocity = MIN (coords->velocity, 1.0); } - if (inertia_factor > 0) + if (inertia_factor > 0 && coords->distance > 0) { /* Apply smoothing to X and Y. */ - /* This tells how far from the pointer can stray from the line */ + /* This tells how far from the pointer can stray from the line */ gdouble max_deviation = SQR (20 * inertia_factor); gdouble cur_deviation = max_deviation; gdouble sin_avg; @@ -295,13 +296,13 @@ cur_deviation = SQR (coords->x - new_x) + SQR (coords->y - new_y); while (cur_deviation >= max_deviation) - { - new_x = new_x * 0.8 + coords->x * 0.2; - new_y = new_y * 0.8 + coords->y * 0.2; - - cur_deviation = (SQR (coords->x - new_x) + - SQR (coords->y - new_y)); - } + { + new_x = new_x * 0.8 + coords->x * 0.2; + new_y = new_y * 0.8 + coords->y * 0.2; + + cur_deviation = (SQR (coords->x - new_x) + + SQR (coords->y - new_y)); + } coords->x = new_x; coords->y = new_y; @@ -323,7 +324,6 @@ coords->distance - dist, inertia_factor); #endif - } shell->last_coords = *coords; --- gimp-2.4.3-/app/display/gimpdisplayshell-coords.h Mon Jan 28 06:14:45 2008 +++ gimp-painter--2.4.3/app/display/gimpdisplayshell-coords.h Mon Jan 28 04:23:26 2008 @@ -41,6 +41,7 @@ gboolean gimp_display_shell_eval_event (GimpDisplayShell *shell, GimpCoords *coords, gdouble inertia_factor, + gdouble filter_threshhold, guint32 time);