McJtyMods/McJtyLib

[1.12.2] Scrolling mouse wheel when hovering on top of GUI Widget fires doubleClickEvent

PolyacovYury opened this issue · 1 comments

    @Override
    public Widget<?> mouseClick(int x, int y, int button) {
        // snip
        long t = System.currentTimeMillis();
        if (prevTime != -1 && (t - prevTime) < 250) {
            fireDoubleClickEvent(selected);
        }
        prevTime = t;
    }

As you can see, any mouse click event fired in quick succession causes children to react to a double click. It doesn't matter, what button was pressed - left click, right click or mouse scroll.

Result: scrolling in XNet Controller GUI when mouse is hovering on top of one of the blocks' lines results in GUI closing and highlighting that block.

The problem traces back to the fact that Minecraft itself fires mouseClicked event in handleMouseInput even if no mouse button was pressed but the scroll wheel.