summaryrefslogtreecommitdiff
path: root/tikzit/src/gtk
diff options
context:
space:
mode:
authorAlex Merry <alex.merry@cs.ox.ac.uk>2012-07-31 14:38:03 +0100
committerAlex Merry <alex.merry@cs.ox.ac.uk>2012-07-31 14:38:03 +0100
commitf82e146a47db9c8bd639f5f32f3e123694d05a4e (patch)
tree01ace7311c48aec94a3ae3c4724ed6ea22c47105 /tikzit/src/gtk
parentbaa3a8fd3396bbbcd7525f2bc96f317d6a341eb6 (diff)
Only consider left-button mouse events
Previously, clicking the right mouse button while dragging with the left button would confuse the code, as things would happen in an unexpected order. This could leave dangling edges, for example, or even crash tikzit.
Diffstat (limited to 'tikzit/src/gtk')
-rw-r--r--tikzit/src/gtk/GraphInputHandler.m12
1 files changed, 12 insertions, 0 deletions
diff --git a/tikzit/src/gtk/GraphInputHandler.m b/tikzit/src/gtk/GraphInputHandler.m
index aec0b7b..02d39a1 100644
--- a/tikzit/src/gtk/GraphInputHandler.m
+++ b/tikzit/src/gtk/GraphInputHandler.m
@@ -169,6 +169,9 @@ static const InputMask unionSelectMask = ShiftMask;
}
- (void) mousePressAt:(NSPoint)pos withButton:(MouseButton)button andMask:(InputMask)mask {
+ if (button != LeftButton)
+ return;
+
dragOrigin = pos;
// we should already be in a quiet state, but no harm in making sure
@@ -244,6 +247,9 @@ static const InputMask unionSelectMask = ShiftMask;
}
- (void) mouseReleaseAt:(NSPoint)pos withButton:(MouseButton)button andMask:(InputMask)mask {
+ if (button != LeftButton)
+ return;
+
if (state == SelectBoxState) {
BOOL shouldDeselect = !(mask & unionSelectMask);
if (shouldDeselect) {
@@ -284,6 +290,9 @@ static const InputMask unionSelectMask = ShiftMask;
}
- (void) mouseDoubleClickAt:(NSPoint)pos withButton:(MouseButton)button andMask:(InputMask)mask {
+ if (button != LeftButton)
+ return;
+
if (mode != SelectMode) {
return;
}
@@ -308,6 +317,9 @@ static const InputMask unionSelectMask = ShiftMask;
}
- (void) mouseMoveTo:(NSPoint)pos withButtons:(MouseButton)buttons andMask:(InputMask)mask {
+ if (!(buttons & LeftButton))
+ return;
+
Transformer *transformer = [renderer transformer];
if (state == ToggleSelectState) {