[gimp] More tool event log output and some minor whitespace cleanup



commit b77cbdf3a1195e96c7a0d1a41790a380c7db7651
Author: Michael Natterer <mitch gimp org>
Date:   Thu Sep 17 09:10:39 2009 +0200

    More tool event log output and some minor whitespace cleanup

 app/display/gimpdisplayshell-callbacks.c |   48 +++++++++++++++---------------
 app/display/gimpdisplayshell-coords.c    |   15 ++++-----
 2 files changed, 31 insertions(+), 32 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-callbacks.c b/app/display/gimpdisplayshell-callbacks.c
index e83696c..fded192 100644
--- a/app/display/gimpdisplayshell-callbacks.c
+++ b/app/display/gimpdisplayshell-callbacks.c
@@ -787,8 +787,8 @@ gimp_display_shell_canvas_tool_events (GtkWidget        *canvas,
         if (! GTK_WIDGET_HAS_FOCUS (canvas))
           gtk_widget_grab_focus (canvas);
 
-        GIMP_LOG (TOOL_EVENTS, "event (display %p): BUTTON_PRESS (%d)",
-                  display, bevent->button);
+        GIMP_LOG (TOOL_EVENTS, "event (display %p): BUTTON_PRESS (%d @ %0.0f:%0.0f)",
+                  display, bevent->button, bevent->x, bevent->y);
 
         /*  if the toplevel window didn't have focus, the above
          *  gtk_widget_grab_focus() didn't set the canvas' HAS_FOCUS
@@ -981,8 +981,8 @@ gimp_display_shell_canvas_tool_events (GtkWidget        *canvas,
       {
         GdkEventButton *bevent = (GdkEventButton *) event;
 
-        GIMP_LOG (TOOL_EVENTS, "event (display %p): 2BUTTON_PRESS (%d)",
-                  display, bevent->button);
+        GIMP_LOG (TOOL_EVENTS, "event (display %p): 2BUTTON_PRESS (%d @ %0.0f:%0.0f)",
+                  display, bevent->button, bevent->x, bevent->y);
 
         if (gimp->busy)
           return TRUE;
@@ -1009,8 +1009,8 @@ gimp_display_shell_canvas_tool_events (GtkWidget        *canvas,
       {
         GdkEventButton *bevent = (GdkEventButton *) event;
 
-        GIMP_LOG (TOOL_EVENTS, "event (display %p): 3BUTTON_PRESS (%d)",
-                  display, bevent->button);
+        GIMP_LOG (TOOL_EVENTS, "event (display %p): 3BUTTON_PRESS (%d @ %0.0f:%0.0f)",
+                  display, bevent->button, bevent->x, bevent->y);
 
         if (gimp->busy)
           return TRUE;
@@ -1037,8 +1037,8 @@ gimp_display_shell_canvas_tool_events (GtkWidget        *canvas,
       {
         GdkEventButton *bevent = (GdkEventButton *) event;
 
-        GIMP_LOG (TOOL_EVENTS, "event (display %p): BUTTON_RELEASE (%d)",
-                  display, bevent->button);
+        GIMP_LOG (TOOL_EVENTS, "event (display %p): BUTTON_RELEASE (%d @ %0.0f:%0.0f)",
+                  display, bevent->button, bevent->x, bevent->y);
 
         gimp_display_shell_autoscroll_stop (shell);
 
@@ -1221,7 +1221,8 @@ gimp_display_shell_canvas_tool_events (GtkWidget        *canvas,
         GdkEventMotion *mevent            = (GdkEventMotion *) event;
         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)
           return TRUE;
@@ -1330,11 +1331,11 @@ gimp_display_shell_canvas_tool_events (GtkWidget        *canvas,
                   {
                     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++)
                       {
-
                         gimp_display_shell_get_time_coords (shell,
                                                             mevent->device,
                                                             history_events[i],
@@ -1374,13 +1375,13 @@ gimp_display_shell_canvas_tool_events (GtkWidget        *canvas,
                          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);
                   }
                 else
                   {
-
                     /* Early removal of useless events saves CPU time.
                      */
                     if (gimp_display_shell_eval_event (shell,
@@ -1404,22 +1405,22 @@ gimp_display_shell_canvas_tool_events (GtkWidget        *canvas,
             /* 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))
               {
-                  /* then update the tool. */
-                  GimpCoords *buf_coords = &g_array_index (shell->event_queue,
-                                                           GimpCoords, 0);
-                  tool_manager_oper_update_active (gimp,
-                                                   buf_coords, state,
-                                                   shell->proximity,
-                                                   display);
-                  /* remove used event */
-                  g_array_remove_index (shell->event_queue, 0);
+                /* then update the tool. */
+                GimpCoords *buf_coords = &g_array_index (shell->event_queue,
+                                                         GimpCoords, 0);
+
+                tool_manager_oper_update_active (gimp,
+                                                 buf_coords, state,
+                                                 shell->proximity,
+                                                 display);
 
+                /* remove used event */
+                g_array_remove_index (shell->event_queue, 0);
               }
 
             gimp_display_shell_push_event_history (shell, &image_coords);
@@ -1945,7 +1946,6 @@ gimp_display_shell_process_tool_event_queue (GimpDisplayShell *shell,
                                   time,
                                   event_state,
                                   shell->display);
-
     }
 
   tool_manager_control_active (shell->display->gimp,
diff --git a/app/display/gimpdisplayshell-coords.c b/app/display/gimpdisplayshell-coords.c
index ae30514..46f1703 100644
--- a/app/display/gimpdisplayshell-coords.c
+++ b/app/display/gimpdisplayshell-coords.c
@@ -295,6 +295,7 @@ gimp_display_shell_eval_event (GimpDisplayShell *shell,
           /* Speed needs upper limit */
           coords->velocity = MIN (coords->velocity, 1.0);
         }
+
       if ((fabs (delta_x) > 1.5) && (fabs (delta_y) > 1.5))
         {
           dir_delta_x = delta_x;
@@ -434,11 +435,9 @@ gimp_display_shell_eval_event (GimpDisplayShell *shell,
             if (shell->event_delay)
               {
                 shell->event_delay = FALSE;
-
               }
-              gimp_display_shell_push_event_history (shell, coords);
-
 
+            gimp_display_shell_push_event_history (shell, coords);
           }
 
 #ifdef VERBOSE
@@ -454,7 +453,6 @@ gimp_display_shell_eval_event (GimpDisplayShell *shell,
 
   g_array_append_val (shell->event_queue, *coords);
 
-
   shell->last_coords            = *coords;
   shell->last_motion_time       = time;
   shell->last_motion_delta_time = delta_time;
@@ -473,6 +471,7 @@ gimp_display_shell_push_event_history (GimpDisplayShell *shell,
 {
    if (shell->event_history->len == 4)
      g_array_remove_index (shell->event_history, 0);
+
    g_array_append_val (shell->event_history, *coords);
 }
 
@@ -480,8 +479,8 @@ static void
 gimp_display_shell_interpolate_stroke (GimpDisplayShell *shell,
                                        GimpCoords       *coords)
 {
-  GArray     *ret_coords;
-  gint       i = shell->event_history->len - 1;
+  GArray *ret_coords;
+  gint    i = shell->event_history->len - 1;
 
   /* Note that there must be exactly one event in buffer or bad things
    * can happen. This should never get called under other circumstances.
@@ -504,11 +503,11 @@ gimp_display_shell_interpolate_stroke (GimpDisplayShell *shell,
                                          &g_array_index (shell->event_queue,
                                                          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_index (ret_coords, GimpCoords, 0),
                        ret_coords->len);
 
-  g_array_free(ret_coords, TRUE);
+  g_array_free (ret_coords, TRUE);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]