gimp r26843 - in trunk: . app/display libgimpwidgets modules plug-ins/ifs-compose



Author: mitch
Date: Wed Sep  3 19:24:51 2008
New Revision: 26843
URL: http://svn.gnome.org/viewvc/gimp?rev=26843&view=rev

Log:
2008-09-03  Michael Natterer  <mitch gimp org>

	* app/display/gimpdisplayshell-callbacks.c
	* libgimpwidgets/gimpcolorselect.c
	* modules/color-selector-water.c
	* plug-ins/ifs-compose/ifs-compose.c: instead of using
	gdk_window_get_pointer() if GdkEventMotion::is_hint is TRUE,
	simply always use the coords from the event and call
	gdk_event_request_motions() to ask for more motion events. This is
	the recommended way and also works for events from devices other
	than the core pointer.

	* plug-ins/ifs-compose/ifs-compose.c (design_area_motion): some
	code cleanup while i was at it.



Modified:
   trunk/ChangeLog
   trunk/app/display/gimpdisplayshell-callbacks.c
   trunk/libgimpwidgets/gimpcolorselect.c
   trunk/modules/color-selector-water.c
   trunk/plug-ins/ifs-compose/ifs-compose.c

Modified: trunk/app/display/gimpdisplayshell-callbacks.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-callbacks.c	(original)
+++ trunk/app/display/gimpdisplayshell-callbacks.c	Wed Sep  3 19:24:51 2008
@@ -1137,15 +1137,8 @@
               }
           }
 
-        /* Ask for the pointer position, but ignore it except for cursor
-         * handling, so motion events sync with the button press/release events
-         */
-        if (mevent->is_hint)
-          {
-            gimp_display_shell_get_device_coords (shell,
-                                                  mevent->device,
-                                                  &display_coords);
-          }
+        /* Ask for more motion events in case the event was a hint */
+        gdk_event_request_motions (mevent);
 
         update_sw_cursor = TRUE;
 

Modified: trunk/libgimpwidgets/gimpcolorselect.c
==============================================================================
--- trunk/libgimpwidgets/gimpcolorselect.c	(original)
+++ trunk/libgimpwidgets/gimpcolorselect.c	Wed Sep  3 19:24:51 2008
@@ -667,15 +667,8 @@
 
     case GDK_MOTION_NOTIFY:
       mevent = (GdkEventMotion *) event;
-      if (mevent->is_hint)
-        {
-          gdk_window_get_pointer (widget->window, &x, &y, NULL);
-        }
-      else
-        {
-          x = mevent->x;
-          y = mevent->y;
-        }
+      x = mevent->x;
+      y = mevent->y;
       break;
 
     default:
@@ -700,8 +693,8 @@
 
   gimp_color_select_update (select, UPDATE_VALUES | UPDATE_CALLER);
 
-  if (event->type == GDK_MOTION_NOTIFY)
-    gdk_event_request_motions ((GdkEventMotion *) event);
+  /* Ask for more motion events in case the event was a hint */
+  gdk_event_request_motions ((GdkEventMotion *) event);
 
   return TRUE;
 }
@@ -760,14 +753,7 @@
 
     case GDK_MOTION_NOTIFY:
       mevent = (GdkEventMotion *) event;
-      if (mevent->is_hint)
-        {
-          gdk_window_get_pointer (widget->window, NULL, &z, NULL);
-        }
-      else
-        {
-          z = mevent->y;
-        }
+      z = mevent->y;
       break;
 
     default:
@@ -787,6 +773,9 @@
   gimp_color_select_update (select,
                             UPDATE_VALUES | UPDATE_XY_COLOR | UPDATE_CALLER);
 
+  /* Ask for more motion events in case the event was a hint */
+  gdk_event_request_motions ((GdkEventMotion *) event);
+
   return TRUE;
 }
 

Modified: trunk/modules/color-selector-water.c
==============================================================================
--- trunk/modules/color-selector-water.c	(original)
+++ trunk/modules/color-selector-water.c	Wed Sep  3 19:24:51 2008
@@ -395,8 +395,8 @@
         }
     }
 
-  if (event->is_hint)
-    gdk_device_get_state (event->device, event->window, NULL, NULL);
+  /* Ask for more motion events in case the event was a hint */
+  gdk_event_request_motions (event);
 
   return TRUE;
 }

Modified: trunk/plug-ins/ifs-compose/ifs-compose.c
==============================================================================
--- trunk/plug-ins/ifs-compose/ifs-compose.c	(original)
+++ trunk/plug-ins/ifs-compose/ifs-compose.c	Wed Sep  3 19:24:51 2008
@@ -1694,25 +1694,18 @@
 design_area_motion (GtkWidget      *widget,
                     GdkEventMotion *event)
 {
-  gint i;
+  gint    i;
   gdouble xo;
   gdouble yo;
   gdouble xn;
   gdouble yn;
-  gint px, py;
-  gdouble width = ifsDesign->area->allocation.width;
+  gdouble width  = ifsDesign->area->allocation.width;
   gdouble height = ifsDesign->area->allocation.height;
 
   Aff2 trans, t1, t2, t3;
 
-  if (!(ifsDesign->button_state & GDK_BUTTON1_MASK)) return FALSE;
-
-  if (event->is_hint)
-    {
-      gtk_widget_get_pointer (ifsDesign->area, &px, &py);
-      event->x = px;
-      event->y = py;
-    }
+  if (! (ifsDesign->button_state & GDK_BUTTON1_MASK))
+    return FALSE;
 
   xo = (ifsDesign->op_x - ifsDesign->op_xcenter);
   yo = (ifsDesign->op_y - ifsDesign->op_ycenter);
@@ -1722,36 +1715,32 @@
   switch (ifsDesign->op)
     {
     case OP_ROTATE:
-      {
-        aff2_translate (&t1,-ifsDesign->op_xcenter*width,
-                       -ifsDesign->op_ycenter*width);
-        aff2_scale (&t2,
-                   sqrt((SQR(xn)+SQR(yn))/(SQR(xo)+SQR(yo))),
-                   0);
-        aff2_compose (&t3, &t2, &t1);
-        aff2_rotate (&t1, - atan2(yn, xn) + atan2(yo, xo));
-        aff2_compose (&t2, &t1, &t3);
-        aff2_translate (&t3, ifsDesign->op_xcenter*width,
-                       ifsDesign->op_ycenter*width);
-        aff2_compose (&trans, &t3, &t2);
-        break;
-      }
+      aff2_translate (&t1,-ifsDesign->op_xcenter*width,
+                      -ifsDesign->op_ycenter*width);
+      aff2_scale (&t2,
+                  sqrt((SQR(xn)+SQR(yn))/(SQR(xo)+SQR(yo))),
+                  0);
+      aff2_compose (&t3, &t2, &t1);
+      aff2_rotate (&t1, - atan2(yn, xn) + atan2(yo, xo));
+      aff2_compose (&t2, &t1, &t3);
+      aff2_translate (&t3, ifsDesign->op_xcenter*width,
+                      ifsDesign->op_ycenter*width);
+      aff2_compose (&trans, &t3, &t2);
+      break;
+
     case OP_STRETCH:
-      {
-        aff2_translate (&t1,-ifsDesign->op_xcenter*width,
-                       -ifsDesign->op_ycenter*width);
-        aff2_compute_stretch (&t2, xo, yo, xn, yn);
-        aff2_compose (&t3, &t2, &t1);
-        aff2_translate (&t1, ifsDesign->op_xcenter*width,
-                       ifsDesign->op_ycenter*width);
-        aff2_compose (&trans, &t1, &t3);
-        break;
-      }
+      aff2_translate (&t1,-ifsDesign->op_xcenter*width,
+                      -ifsDesign->op_ycenter*width);
+      aff2_compute_stretch (&t2, xo, yo, xn, yn);
+      aff2_compose (&t3, &t2, &t1);
+      aff2_translate (&t1, ifsDesign->op_xcenter*width,
+                      ifsDesign->op_ycenter*width);
+      aff2_compose (&trans, &t1, &t3);
+      break;
+
     case OP_TRANSLATE:
-      {
-        aff2_translate (&trans,(xn-xo)*width,(yn-yo)*width);
-        break;
-      }
+      aff2_translate (&trans,(xn-xo)*width,(yn-yo)*width);
+      break;
     }
 
   for (i = 0; i < ifsvals.num_elements; i++)
@@ -1775,16 +1764,20 @@
             aff2_compose (&elements[i]->trans, &trans,
                          &ifsD->selected_orig[i].trans);
           }
+
         aff_element_decompose_trans (elements[i],&elements[i]->trans,
                                     width, height, ifsvals.center_x,
                                     ifsvals.center_y);
         aff_element_compute_trans (elements[i],width, height,
-                              ifsvals.center_x, ifsvals.center_y);
+                                   ifsvals.center_x, ifsvals.center_y);
       }
 
   update_values ();
   design_area_redraw ();
 
+  /* Ask for more motion events in case the event was a hint */
+  gdk_event_request_motions (event);
+
   return FALSE;
 }
 



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