From e3813131b791bba06bbabd75e23a74925ccb142c Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Wed, 25 Apr 2007 10:10:43 +0000 Subject: [PATCH] also use the middle mouse button for panning. 2007-04-25 Sven Neumann * libgimpwidgets/gimpscrolledpreview.c: also use the middle mouse button for panning. * plug-ins/common/nova.c: override the default mouse handling of the GimpScrolledPreview and allow to reposition the center using the left mouse button. Fixes bug #364432. * app/tools/gimprectangletool.c: formatting. svn path=/trunk/; revision=22319 --- ChangeLog | 11 +++++++++++ app/tools/gimprectangletool.c | 12 ++++++------ libgimpwidgets/gimpscrolledpreview.c | 24 +++++++++++++----------- plug-ins/common/nova.c | 16 ++++++++++++---- 4 files changed, 42 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index b93796b259..ef2230f1e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2007-04-25 Sven Neumann + + * libgimpwidgets/gimpscrolledpreview.c: also use the middle mouse + button for panning. + + * plug-ins/common/nova.c: override the default mouse handling of + the GimpScrolledPreview and allow to reposition the center using + the left mouse button. Fixes bug #364432. + + * app/tools/gimprectangletool.c: formatting. + 2007-04-24 Sven Neumann * configure.in: bumped version to 2.3.17. diff --git a/app/tools/gimprectangletool.c b/app/tools/gimprectangletool.c index 0083a32829..12d8d2a8aa 100644 --- a/app/tools/gimprectangletool.c +++ b/app/tools/gimprectangletool.c @@ -1967,15 +1967,15 @@ gimp_rectangle_tool_rectangle_changed (GimpRectangleTool *rectangle) /* * check whether the coordinates extend outside the bounds of the image - * or active drawable, if it is constrained not to. If it does,truncates - * the corrners to the constraints. + * or active drawable, if it is constrained not to. If it does, clamp + * the corners to the constraints. */ void gimp_rectangle_tool_constrain (GimpRectangleTool *rectangle, - gint *x1, - gint *y1, - gint *x2, - gint *y2) + gint *x1, + gint *y1, + gint *x2, + gint *y2) { GimpTool *tool = GIMP_TOOL (rectangle); GimpRectangleToolPrivate *private; diff --git a/libgimpwidgets/gimpscrolledpreview.c b/libgimpwidgets/gimpscrolledpreview.c index e6c28471da..f5828ecd7a 100644 --- a/libgimpwidgets/gimpscrolledpreview.c +++ b/libgimpwidgets/gimpscrolledpreview.c @@ -32,8 +32,8 @@ #include "libgimp/libgimp-intl.h" -#define POPUP_SIZE 100 -#define PEN_WIDTH 3 +#define POPUP_SIZE 100 +#define PEN_WIDTH 3 typedef struct @@ -129,9 +129,9 @@ gimp_scrolled_preview_class_init (GimpScrolledPreviewClass *klass) parent_class = g_type_class_peek_parent (klass); - object_class->dispose = gimp_scrolled_preview_dispose; + object_class->dispose = gimp_scrolled_preview_dispose; - preview_class->set_cursor = gimp_scrolled_preview_set_cursor; + preview_class->set_cursor = gimp_scrolled_preview_set_cursor; g_type_class_add_private (object_class, sizeof (GimpScrolledPreviewPrivate)); } @@ -188,9 +188,12 @@ gimp_scrolled_preview_init (GimpScrolledPreview *preview) preview->vscr, 1, 2, 0, 1, GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - g_signal_connect (GIMP_PREVIEW (preview)->area, "event", - G_CALLBACK (gimp_scrolled_preview_area_event), - preview); + /* Connect after here so that plug-ins get a chance to override the + * default behavior. See bug #364432. + */ + g_signal_connect_after (GIMP_PREVIEW (preview)->area, "event", + G_CALLBACK (gimp_scrolled_preview_area_event), + preview); g_signal_connect (GIMP_PREVIEW (preview)->area, "realize", G_CALLBACK (gimp_scrolled_preview_area_realize), @@ -374,6 +377,7 @@ gimp_scrolled_preview_area_event (GtkWidget *area, switch (button_event->button) { case 1: + case 2: gtk_widget_get_pointer (area, &priv->drag_x, &priv->drag_y); priv->drag_xoff = GIMP_PREVIEW (preview)->xoff; @@ -382,16 +386,14 @@ gimp_scrolled_preview_area_event (GtkWidget *area, gtk_grab_add (area); break; - case 2: - break; - case 3: return TRUE; } break; case GDK_BUTTON_RELEASE: - if (priv->in_drag && button_event->button == 1) + if (priv->in_drag && + (button_event->button == 1 || button_event->button == 2)) { gtk_grab_remove (area); priv->in_drag = FALSE; diff --git a/plug-ins/common/nova.c b/plug-ins/common/nova.c index 47309a59db..2e80e19c3b 100644 --- a/plug-ins/common/nova.c +++ b/plug-ins/common/nova.c @@ -324,7 +324,8 @@ nova_dialog (GimpDrawable *drawable) preview = gimp_zoom_preview_new (drawable); gtk_widget_add_events (GIMP_PREVIEW (preview)->area, - GDK_POINTER_MOTION_MASK); + GDK_BUTTON_PRESS_MASK | + GDK_BUTTON1_MOTION_MASK); gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0); gtk_widget_show (preview); @@ -657,8 +658,15 @@ nova_center_preview_events (GtkWidget *widget, { GdkEventMotion *mevent = (GdkEventMotion *) event; - if (mevent->state & GDK_BUTTON2_MASK) - return nova_center_update (widget, center, mevent->x, mevent->y); + if (mevent->state & GDK_BUTTON1_MASK) + { + GdkModifierType mask; + gint x, y; + + gdk_window_get_pointer (widget->window, &x, &y, &mask); + + return nova_center_update (widget, center, x, y); + } } break; @@ -666,7 +674,7 @@ nova_center_preview_events (GtkWidget *widget, { GdkEventButton *bevent = (GdkEventButton *) event; - if (bevent->button == 2) + if (bevent->button == 1) return nova_center_update (widget, center, bevent->x, bevent->y); } break;