How to get mouse position in screen space and not relative to widget?

I’m trying to get the mouse position in screen space and NOT in the relative space of the current widget and can’t figure out how to do this.

For example:

  1. The node “GetViewportSize” returns the current resolution of the window the game runs in. This is exactly the space I need, (In my preview case: 1280 x 720)
  2. The nodes “GetMousePositionScaledbyDPI” and “GetMousePositiononViewport” return the mouse location in the relative space of the widget and so the top right corner of the screen equals X = 1920 and NOT 1280, which is the top right corner based on my current play window size.

Any suggestions how I can get the correct mouse position based on the current size of my play window?

Thanks and best regards,
Daniel

I would just get this really awesome plugin that adds a bunch of blueprint nodes including get mouse position on screen and get mouse position percentage on screen.

https://www.unrealengine.com/marketplace/item/f6637ea9663447e4b6a0578216992e70

you can use bool APlayerController::GetMousePosition(float& LocationX, float& LocationY) const.