summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4d86612)
raw | patch | inline | side by side (parent: 4d86612)
author | Krzysztof Kosiński <tweenk.pl@gmail.com> | |
Wed, 20 Jan 2010 16:37:55 +0000 (17:37 +0100) | ||
committer | Krzysztof Kosiński <tweenk.pl@gmail.com> | |
Wed, 20 Jan 2010 16:37:55 +0000 (17:37 +0100) |
src/ui/tool/selector.cpp | patch | blob | history |
index f95c9e064b285296a3303b3d5f25a3bf5e8cb68e..bf3ea67144016c221237b0329e9e2361b2140261 100644 (file)
--- a/src/ui/tool/selector.cpp
+++ b/src/ui/tool/selector.cpp
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)
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;