godotengine / godotengine/godot

macOS: In non floating embedded game, switching from Input.MOUSE_MODE_CAPTURED to Input.MOUSE_MODE_VISIBLE moves the mouse to the wrong location

Open
#109,902 5 comments 0 reactions 1 assignee Claimed by @bruvzg View on GitHub
bug platform:macos topic:input topic:platforms
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

- Reproducible in 4.5 beta 6

### System information

Godot v4.5.beta (5d2be5423) - macOS Sequoia (15.6.1) - Multi-window, 1 monitor - Metal (Forward+) - integrated Apple M4 Max (Apple9) - Apple M4 Max (14 threads) - 36.00 GiB memory

### Issue description

As you can see in the gif below, switching from Input.MOUSE_MODE_CAPTURED to Input.MOUSE_MODE_VISIBLE in non floating embedding moves the mouse to the center of the display instead of the center of the window.

![Image](https://github.com/user-attachments/assets/5566e402-ad3a-49fb-a1d0-2a85de20931f)

It works as expected when using floating game embedding even when the window is moved, showing the mouse in the center of the window.

![Image](https://github.com/user-attachments/assets/3c3a104a-60c8-4e9a-b992-28e80a914dfc)

### Steps to reproduce

1. Disable "Make Workspace Floating on Next Play"
2. Toggle between Input.MOUSE_MODE_CAPTURED and Input.MOUSE_MODE_VISIBLE

### Minimal reproduction project (MRP)

[mouse-mode-position.zip](https://github.com/user-attachments/files/21948178/mouse-mode-position.zip)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.