From 35295a19d4d6164caf2af84d18701ab292e24fb5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Krzysztof=20Kosi=C5=84ski?= Date: Wed, 20 Jan 2010 17:37:55 +0100 Subject: [PATCH] Fix middle click zoom in the node tool. --- src/ui/tool/selector.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ui/tool/selector.cpp b/src/ui/tool/selector.cpp index f95c9e064..bf3ea6714 100644 --- a/src/ui/tool/selector.cpp +++ b/src/ui/tool/selector.cpp @@ -21,7 +21,9 @@ namespace Inkscape { namespace UI { /** A hidden control point used for rubberbanding and selection. - * It uses a clever hack: the canvas item is hidden and only receives events when fed */ + * It uses a clever hack: the canvas item is hidden and only receives events when they + * are passed to it using Selector's event() function. When left mouse button + * is pressed, it grabs events and handles drags and clicks in the usual way. */ class SelectorPoint : public ControlPoint { public: SelectorPoint(SPDesktop *d, SPCanvasGroup *group, Selector *s) @@ -109,8 +111,14 @@ Selector::~Selector() bool Selector::event(GdkEvent *event) { + // The hidden control point will capture all events after it obtains the grab, + // but it relies on this function to initiate it. Here we can filter what events + // it will receive. switch (event->type) { case GDK_BUTTON_PRESS: + // Do not pass button presses other than left button to the control point. + // This way middle click and right click can be handled in SPEventContext. + if (event->button.button != 1) return false; _dragger->setPosition(_desktop->w2d(event_point(event->motion))); break; default: break; -- 2.30.2