Weird IsInputKeyDown and UMG behaviour

I’m trying to implement a basic window-drag system, and to do that, detect when the mouse button is down and I’m getting some very strange behaviour:

  • If I double-click (fast) and then hold, then my blueprint (see photo) displays true.
  • If I single-click and hold, then my blueprint displays false.
  • When I double-click-and-hold, I can move my mouse outside of the UE4 game window (standalone game mode).
  • When I single-click-and-hold, my mouse is locked inside the UE4 game window.
  • If I click on a UMG element, IsInputKeyDown always returns false.

I’ve tried all possible combinations of SetInputModeGameAndUI and the project input settings related to mouse, and nothing helps.

What is going on here? I just want to reliably detect if the mouse is down.