-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix incorrect input cursor position on MacOS with retina screen in use #1607
fix incorrect input cursor position on MacOS with retina screen in use #1607
Conversation
Let a 3 bytes UTF-8 data = [0xE4, 0x8A, 0xBC], when b = 0xE4 (1110 0100), it will be treated as 2 bytes. See this part: ```java if (b < 0x80) { // good } else if ((b & 0xC0) == 0xC0) {// (0xE4 & 0xC0) == 0xC0 =====> true utf8State = UTF8_2BYTE; } else if ((b & 0xE0) == 0xE0) {// (0xE4 & 0xE0) == 0xE0 =====> true utf8State = UTF8_3BYTE_1; } else { utf8State = UTF8_ILLEGAL; } ``` 3 bytes UTF-8 data while always be treated as 2 bytes UTF-8 data. It's better that always treat String data as UTF-8 now. see https://hub.jmonkeyengine.org/t/code-error-on-checking-utf-8-data/43909
…ll resolution framebuffers on Retina Display
…e don't get any callback when it is changed.So just get it from time to time when mouse cursor is moved.
Is this ready for review or integration? If not, please mark it as a draft. |
It's ready, sir. |
jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java
Outdated
Show resolved
Hide resolved
@tonihele please continue the conversations you started or else mark them as "resolved". |
Yep, sorry it took so long. |
Unless there are objections, this will be integrated in about 24 hours. |
Changed the default setting for "UseRetinaFrameBuffer" to |
Further fixes proposed in PR #1746. |
On MacOS, with retina screen in use, the input cursor position is incorrect. As the window size is not equals to camera resolution.
This PR use glfwGetWindowContentScale to get the scaling factor on window resolution, and apply it to GlfwMouseInput#onCursorPos callback. So we have the correct cursor position on MacOS.
For more information, there are the links:
This PR is also trying to fix part of issue #893