From fa3275ccca1a38ef034e3b0eda2f0354442c378e Mon Sep 17 00:00:00 2001 From: Marukyu Date: Fri, 14 Oct 2016 21:39:36 +0200 Subject: [PATCH] Added support for simulating right/middle clicks with shift/control This improves usability with input devices lacking a right or middle mouse button. --- src/Client/Editor/Editor.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Client/Editor/Editor.cpp b/src/Client/Editor/Editor.cpp index 8cf6669..76b43dc 100644 --- a/src/Client/Editor/Editor.cpp +++ b/src/Client/Editor/Editor.cpp @@ -126,9 +126,12 @@ void Editor::onProcess(const gui2::WidgetEvents& events) { sf::Vector2f mousePos = convertMousePosition(events.mousePosition); - bool leftMouseDown = isMouseDown(sf::Mouse::Left); - bool rightMouseDown = isMouseDown(sf::Mouse::Right); - bool middleMouseDown = isMouseDown(sf::Mouse::Middle); + bool shiftLeftMouseDown = isMouseDown(sf::Mouse::Left) && events.isShiftPressed(); + bool ctrlLeftMouseDown = isMouseDown(sf::Mouse::Left) && events.isControlPressed(); + + bool leftMouseDown = isMouseDown(sf::Mouse::Left) && !shiftLeftMouseDown && !ctrlLeftMouseDown; + bool rightMouseDown = isMouseDown(sf::Mouse::Right) || shiftLeftMouseDown; + bool middleMouseDown = isMouseDown(sf::Mouse::Middle) || ctrlLeftMouseDown; if (middleMouseDown) {