gimp r27339 - in trunk: . plug-ins/common



Author: neo
Date: Mon Oct 20 13:27:00 2008
New Revision: 27339
URL: http://svn.gnome.org/viewvc/gimp?rev=27339&view=rev

Log:
2008-10-20  Sven Neumann  <sven sven>

	* plug-ins/common/bump-map.c (dialog_preview_events): use 
pointer
	coordinates from the passed event instead of calling
	gtk_widget_get_pointer().



Modified:
   trunk/ChangeLog
   trunk/plug-ins/common/bump-map.c

Modified: trunk/plug-ins/common/bump-map.c
==============================================================================
--- trunk/plug-ins/common/bump-map.c	(original)
+++ trunk/plug-ins/common/bump-map.c	Mon Oct 20 13:27:00 2008
@@ -144,7 +144,7 @@
 static gboolean bumpmap_dialog             (void);
 static void     dialog_new_bumpmap         (gboolean       init_offsets);
 static void     dialog_update_preview      (GimpPreview   *preview);
-static gint     dialog_preview_events      (GtkWidget     *area,
+static gboolean dialog_preview_events      (GtkWidget     *area,
                                             GdkEvent      *event,
                                             GimpPreview   *preview);
 static void     dialog_get_rows            (GimpPixelRgn  *pr,
@@ -1001,38 +1001,34 @@
   return run;
 }
 
-static gint
+static gboolean
 dialog_preview_events (GtkWidget   *area,
                        GdkEvent    *event,
                        GimpPreview *preview)
 {
-  gint            x, y;
-  gint            dx, dy;
-  GdkEventButton *bevent;
-
-  gtk_widget_get_pointer (area, &x, &y);
-
-  bevent = (GdkEventButton *) event;
-
   switch (event->type)
     {
     case GDK_BUTTON_PRESS:
-      switch (bevent->button)
-        {
-        case 2:
-          bmint.drag_mode = DRAG_BUMPMAP;
-          break;
+      {
+        GdkEventButton *bevent = (GdkEventButton *) event;
 
-        default:
-          return FALSE;
-        }
+        switch (bevent->button)
+          {
+          case 2:
+            bmint.drag_mode = DRAG_BUMPMAP;
+            break;
 
-      bmint.mouse_x = x;
-      bmint.mouse_y = y;
+          default:
+            return FALSE;
+          }
 
-      gtk_grab_add (area);
+        bmint.mouse_x = bevent->x;
+        bmint.mouse_y = bevent->y;
 
-      return TRUE;
+        gtk_grab_add (area);
+
+        return TRUE;
+      }
       break;
 
     case GDK_BUTTON_RELEASE:
@@ -1044,50 +1040,53 @@
 
           return TRUE;
         }
-
       break;
 
     case GDK_MOTION_NOTIFY:
-      dx = x - bmint.mouse_x;
-      dy = y - bmint.mouse_y;
+      {
+        GdkEventMotion *mevent = (GdkEventMotion *) event;
+        gint            dx     = mevent->x - bmint.mouse_x;
+        gint            dy     = mevent->y - bmint.mouse_y;
 
-      bmint.mouse_x = x;
-      bmint.mouse_y = y;
+        bmint.mouse_x = mevent->x;
+        bmint.mouse_y = mevent->y;
 
-      if ((dx == 0) && (dy == 0))
-        break;
+        gdk_event_request_motions (mevent);
 
-      switch (bmint.drag_mode)
-        {
-        case DRAG_BUMPMAP:
-          bmvals.xofs = CLAMP (bmvals.xofs - dx, -1000, 1000);
-          g_signal_handlers_block_by_func (bmint.offset_adj_x,
-                                           gimp_int_adjustment_update,
-                                           &bmvals.xofs);
-          gtk_adjustment_set_value (GTK_ADJUSTMENT (bmint.offset_adj_x),
-                                    bmvals.xofs);
-          g_signal_handlers_unblock_by_func (bmint.offset_adj_x,
+        if ((dx == 0) && (dy == 0))
+          break;
+
+        switch (bmint.drag_mode)
+          {
+          case DRAG_BUMPMAP:
+            bmvals.xofs = CLAMP (bmvals.xofs - dx, -1000, 1000);
+            g_signal_handlers_block_by_func (bmint.offset_adj_x,
                                              gimp_int_adjustment_update,
                                              &bmvals.xofs);
+            gtk_adjustment_set_value (GTK_ADJUSTMENT (bmint.offset_adj_x),
+                                      bmvals.xofs);
+            g_signal_handlers_unblock_by_func (bmint.offset_adj_x,
+                                               gimp_int_adjustment_update,
+                                               &bmvals.xofs);
 
-          bmvals.yofs = CLAMP (bmvals.yofs - dy, -1000, 1000);
-          g_signal_handlers_block_by_func (bmint.offset_adj_y,
-                                           gimp_int_adjustment_update,
-                                           &bmvals.yofs);
-          gtk_adjustment_set_value (GTK_ADJUSTMENT (bmint.offset_adj_y),
-                                    bmvals.yofs);
-          g_signal_handlers_unblock_by_func (bmint.offset_adj_y,
+            bmvals.yofs = CLAMP (bmvals.yofs - dy, -1000, 1000);
+            g_signal_handlers_block_by_func (bmint.offset_adj_y,
                                              gimp_int_adjustment_update,
                                              &bmvals.yofs);
-          break;
+            gtk_adjustment_set_value (GTK_ADJUSTMENT (bmint.offset_adj_y),
+                                      bmvals.yofs);
+            g_signal_handlers_unblock_by_func (bmint.offset_adj_y,
+                                               gimp_int_adjustment_update,
+                                               &bmvals.yofs);
+            break;
+
+          default:
+            return FALSE;
+          }
 
-        default:
-          return FALSE;
-        }
-
-      gimp_preview_invalidate (preview);
-
-      return TRUE;
+        gimp_preview_invalidate (preview);
+        return TRUE;
+      }
       break;
 
     default:



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