From f82e146a47db9c8bd639f5f32f3e123694d05a4e Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Tue, 31 Jul 2012 14:38:03 +0100 Subject: 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. --- tikzit/src/gtk/GraphInputHandler.m | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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) { -- cgit v1.2.3