Skip to content

Commit e18b6c5

Browse files
committedDec 12, 2020
GUIFormSpecMenu: Shift+Click listring workaround for MacOS
event.MouseInput.Shift is not implemented for MacOS
1 parent af07343 commit e18b6c5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed
 

‎src/gui/guiFormSpecMenu.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -4075,6 +4075,9 @@ enum ButtonEventType : u8
40754075

40764076
bool GUIFormSpecMenu::OnEvent(const SEvent& event)
40774077
{
4078+
// WORKAROUND: event.MouseInput.Shift is not implemented for MacOS
4079+
static thread_local bool is_shift_down = false;
4080+
40784081
if (event.EventType==EET_KEY_INPUT_EVENT) {
40794082
KeyPress kp(event.KeyInput);
40804083
if (event.KeyInput.PressedDown && (
@@ -4084,6 +4087,8 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
40844087
return true;
40854088
}
40864089

4090+
is_shift_down = event.KeyInput.Shift;
4091+
40874092
if (m_client != NULL && event.KeyInput.PressedDown &&
40884093
(kp == getKeySetting("keymap_screenshot"))) {
40894094
m_client->makeScreenshot();
@@ -4133,6 +4138,9 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
41334138
event.MouseInput.isRightPressed() &&
41344139
getItemAtPos(m_pointer).i != getItemAtPos(m_old_pointer).i))) {
41354140

4141+
// WORKAROUND: In case shift was pressed prior showing the formspec
4142+
is_shift_down |= event.MouseInput.Shift;
4143+
41364144
// Get selected item and hovered/clicked item (s)
41374145

41384146
m_old_tooltip_id = -1;
@@ -4263,7 +4271,7 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
42634271
else // left
42644272
count = s_count;
42654273

4266-
if (!event.MouseInput.Shift) {
4274+
if (!is_shift_down) {
42674275
// no shift: select item
42684276
m_selected_amount = count;
42694277
m_selected_dragging = button != BET_WHEEL_DOWN;

0 commit comments

Comments
 (0)
Please sign in to comment.