Commit b77cbdf3 authored by Michael Natterer's avatar Michael Natterer 😴

More tool event log output and some minor whitespace cleanup

parent fca59092
...@@ -787,8 +787,8 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas, ...@@ -787,8 +787,8 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
if (! GTK_WIDGET_HAS_FOCUS (canvas)) if (! GTK_WIDGET_HAS_FOCUS (canvas))
gtk_widget_grab_focus (canvas); gtk_widget_grab_focus (canvas);
GIMP_LOG (TOOL_EVENTS, "event (display %p): BUTTON_PRESS (%d)", GIMP_LOG (TOOL_EVENTS, "event (display %p): BUTTON_PRESS (%d @ %0.0f:%0.0f)",
display, bevent->button); display, bevent->button, bevent->x, bevent->y);
/* if the toplevel window didn't have focus, the above /* if the toplevel window didn't have focus, the above
* gtk_widget_grab_focus() didn't set the canvas' HAS_FOCUS * gtk_widget_grab_focus() didn't set the canvas' HAS_FOCUS
...@@ -981,8 +981,8 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas, ...@@ -981,8 +981,8 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
{ {
GdkEventButton *bevent = (GdkEventButton *) event; GdkEventButton *bevent = (GdkEventButton *) event;
GIMP_LOG (TOOL_EVENTS, "event (display %p): 2BUTTON_PRESS (%d)", GIMP_LOG (TOOL_EVENTS, "event (display %p): 2BUTTON_PRESS (%d @ %0.0f:%0.0f)",
display, bevent->button); display, bevent->button, bevent->x, bevent->y);
if (gimp->busy) if (gimp->busy)
return TRUE; return TRUE;
...@@ -1009,8 +1009,8 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas, ...@@ -1009,8 +1009,8 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
{ {
GdkEventButton *bevent = (GdkEventButton *) event; GdkEventButton *bevent = (GdkEventButton *) event;
GIMP_LOG (TOOL_EVENTS, "event (display %p): 3BUTTON_PRESS (%d)", GIMP_LOG (TOOL_EVENTS, "event (display %p): 3BUTTON_PRESS (%d @ %0.0f:%0.0f)",
display, bevent->button); display, bevent->button, bevent->x, bevent->y);
if (gimp->busy) if (gimp->busy)
return TRUE; return TRUE;
...@@ -1037,8 +1037,8 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas, ...@@ -1037,8 +1037,8 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
{ {
GdkEventButton *bevent = (GdkEventButton *) event; GdkEventButton *bevent = (GdkEventButton *) event;
GIMP_LOG (TOOL_EVENTS, "event (display %p): BUTTON_RELEASE (%d)", GIMP_LOG (TOOL_EVENTS, "event (display %p): BUTTON_RELEASE (%d @ %0.0f:%0.0f)",
display, bevent->button); display, bevent->button, bevent->x, bevent->y);
gimp_display_shell_autoscroll_stop (shell); gimp_display_shell_autoscroll_stop (shell);
...@@ -1221,7 +1221,8 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas, ...@@ -1221,7 +1221,8 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
GdkEventMotion *mevent = (GdkEventMotion *) event; GdkEventMotion *mevent = (GdkEventMotion *) event;
GdkEvent *compressed_motion = NULL; GdkEvent *compressed_motion = NULL;
GIMP_LOG (TOOL_EVENTS, "event (display %p): MOTION_NOTIFY", display); GIMP_LOG (TOOL_EVENTS, "event (display %p): MOTION_NOTIFY (%0.0f:%0.0f %d)",
display, mevent->x, mevent->y, mevent->time);
if (gimp->busy) if (gimp->busy)
return TRUE; return TRUE;
...@@ -1330,11 +1331,11 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas, ...@@ -1330,11 +1331,11 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
{ {
gint i; gint i;
tool_manager_control_active (gimp, GIMP_TOOL_ACTION_PAUSE, display); tool_manager_control_active (gimp, GIMP_TOOL_ACTION_PAUSE,
display);
for (i = 0; i < n_history_events; i++) for (i = 0; i < n_history_events; i++)
{ {
gimp_display_shell_get_time_coords (shell, gimp_display_shell_get_time_coords (shell,
mevent->device, mevent->device,
history_events[i], history_events[i],
...@@ -1374,13 +1375,13 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas, ...@@ -1374,13 +1375,13 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
shell->last_read_motion_time = history_events[i]->time; shell->last_read_motion_time = history_events[i]->time;
} }
tool_manager_control_active (gimp, GIMP_TOOL_ACTION_RESUME, display); tool_manager_control_active (gimp, GIMP_TOOL_ACTION_RESUME,
display);
gdk_device_free_history (history_events, n_history_events); gdk_device_free_history (history_events, n_history_events);
} }
else else
{ {
/* Early removal of useless events saves CPU time. /* Early removal of useless events saves CPU time.
*/ */
if (gimp_display_shell_eval_event (shell, if (gimp_display_shell_eval_event (shell,
...@@ -1404,22 +1405,22 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas, ...@@ -1404,22 +1405,22 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
/* Early removal of useless events saves CPU time. /* Early removal of useless events saves CPU time.
* Smoothing is 0.0 here for coasting. * Smoothing is 0.0 here for coasting.
*/ */
if (gimp_display_shell_eval_event (shell, if (gimp_display_shell_eval_event (shell,
&image_coords, &image_coords,
0.0, 0.0,
time)) time))
{ {
/* then update the tool. */ /* then update the tool. */
GimpCoords *buf_coords = &g_array_index (shell->event_queue, GimpCoords *buf_coords = &g_array_index (shell->event_queue,
GimpCoords, 0); GimpCoords, 0);
tool_manager_oper_update_active (gimp,
buf_coords, state, tool_manager_oper_update_active (gimp,
shell->proximity, buf_coords, state,
display); shell->proximity,
/* remove used event */ display);
g_array_remove_index (shell->event_queue, 0);
/* remove used event */
g_array_remove_index (shell->event_queue, 0);
} }
gimp_display_shell_push_event_history (shell, &image_coords); gimp_display_shell_push_event_history (shell, &image_coords);
...@@ -1945,7 +1946,6 @@ gimp_display_shell_process_tool_event_queue (GimpDisplayShell *shell, ...@@ -1945,7 +1946,6 @@ gimp_display_shell_process_tool_event_queue (GimpDisplayShell *shell,
time, time,
event_state, event_state,
shell->display); shell->display);
} }
tool_manager_control_active (shell->display->gimp, tool_manager_control_active (shell->display->gimp,
......
...@@ -295,6 +295,7 @@ gimp_display_shell_eval_event (GimpDisplayShell *shell, ...@@ -295,6 +295,7 @@ gimp_display_shell_eval_event (GimpDisplayShell *shell,
/* Speed needs upper limit */ /* Speed needs upper limit */
coords->velocity = MIN (coords->velocity, 1.0); coords->velocity = MIN (coords->velocity, 1.0);
} }
if ((fabs (delta_x) > 1.5) && (fabs (delta_y) > 1.5)) if ((fabs (delta_x) > 1.5) && (fabs (delta_y) > 1.5))
{ {
dir_delta_x = delta_x; dir_delta_x = delta_x;
...@@ -434,11 +435,9 @@ gimp_display_shell_eval_event (GimpDisplayShell *shell, ...@@ -434,11 +435,9 @@ gimp_display_shell_eval_event (GimpDisplayShell *shell,
if (shell->event_delay) if (shell->event_delay)
{ {
shell->event_delay = FALSE; shell->event_delay = FALSE;
} }
gimp_display_shell_push_event_history (shell, coords);
gimp_display_shell_push_event_history (shell, coords);
} }
#ifdef VERBOSE #ifdef VERBOSE
...@@ -454,7 +453,6 @@ gimp_display_shell_eval_event (GimpDisplayShell *shell, ...@@ -454,7 +453,6 @@ gimp_display_shell_eval_event (GimpDisplayShell *shell,
g_array_append_val (shell->event_queue, *coords); g_array_append_val (shell->event_queue, *coords);
shell->last_coords = *coords; shell->last_coords = *coords;
shell->last_motion_time = time; shell->last_motion_time = time;
shell->last_motion_delta_time = delta_time; shell->last_motion_delta_time = delta_time;
...@@ -473,6 +471,7 @@ gimp_display_shell_push_event_history (GimpDisplayShell *shell, ...@@ -473,6 +471,7 @@ gimp_display_shell_push_event_history (GimpDisplayShell *shell,
{ {
if (shell->event_history->len == 4) if (shell->event_history->len == 4)
g_array_remove_index (shell->event_history, 0); g_array_remove_index (shell->event_history, 0);
g_array_append_val (shell->event_history, *coords); g_array_append_val (shell->event_history, *coords);
} }
...@@ -480,8 +479,8 @@ static void ...@@ -480,8 +479,8 @@ static void
gimp_display_shell_interpolate_stroke (GimpDisplayShell *shell, gimp_display_shell_interpolate_stroke (GimpDisplayShell *shell,
GimpCoords *coords) GimpCoords *coords)
{ {
GArray *ret_coords; GArray *ret_coords;
gint i = shell->event_history->len - 1; gint i = shell->event_history->len - 1;
/* Note that there must be exactly one event in buffer or bad things /* Note that there must be exactly one event in buffer or bad things
* can happen. This should never get called under other circumstances. * can happen. This should never get called under other circumstances.
...@@ -504,11 +503,11 @@ gimp_display_shell_interpolate_stroke (GimpDisplayShell *shell, ...@@ -504,11 +503,11 @@ gimp_display_shell_interpolate_stroke (GimpDisplayShell *shell,
&g_array_index (shell->event_queue, &g_array_index (shell->event_queue,
GimpCoords, 0)); GimpCoords, 0));
g_array_set_size(shell->event_queue, 0); g_array_set_size (shell->event_queue, 0);
g_array_append_vals (shell->event_queue, g_array_append_vals (shell->event_queue,
&g_array_index (ret_coords, GimpCoords, 0), &g_array_index (ret_coords, GimpCoords, 0),
ret_coords->len); ret_coords->len);
g_array_free(ret_coords, TRUE); g_array_free (ret_coords, TRUE);
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment