diff options
author | Alex Merry <alex.merry@cs.ox.ac.uk> | 2012-07-31 14:38:03 +0100 |
---|---|---|
committer | Alex Merry <alex.merry@cs.ox.ac.uk> | 2012-07-31 14:38:03 +0100 |
commit | f82e146a47db9c8bd639f5f32f3e123694d05a4e (patch) | |
tree | 01ace7311c48aec94a3ae3c4724ed6ea22c47105 /tikzit/src/gtk/GraphInputHandler.m | |
parent | baa3a8fd3396bbbcd7525f2bc96f317d6a341eb6 (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/GraphInputHandler.m')
-rw-r--r-- | tikzit/src/gtk/GraphInputHandler.m | 12 |
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) { |