Commit Graph

12 Commits

Author SHA1 Message Date
Hajime Hoshi
0bcee31a6f internal/ui: bug fix: wrong monitor initialization on macOS
This change fixes these issues:

* `currentMouseLocation()` returned a position in the macOS native
coordinate. This means the Y axis is upward, while the Y axis is
downward in the GLFW coordinate. This change adjusts the Y position.
* `(*monitors).monitorFromGLFWMonitor` always returned nil at least
on macOS. This change replaces this with a new method
`(*monitors).primaryMonitor`.

Updates #807
Closes #2794
2023-09-29 12:36:28 +09:00
Hajime Hoshi
7cb64ccffe internal/ui: refactoring 2023-09-28 01:01:58 +09:00
Hajime Hoshi
a65a45586f internal/ui: bug fix: need nil check at dipFromGLFWMonitorPixel
Updates #1878
2023-09-25 18:42:23 +09:00
Hajime Hoshi
b32575b7b2 internal/ui: refactoring: add (*Monitor).deviceScaleFactor 2023-09-24 19:41:37 +09:00
Hajime Hoshi
0e23045b90 internal/ui: refactoring: add (*monitors).monitorFromPosition 2023-09-24 19:41:28 +09:00
Hajime Hoshi
c7d1d28582 internal/ui: move impls for device scale to internal/ui for desktops
This enables to remove restrictions for some functions to be called
from the main thread.

Updates #2423
2023-09-24 15:44:41 +09:00
Hajime Hoshi
5d5e3c7c0b internal/ui: refactoring: replace *glfw.Monitor with *Monitor 2023-09-24 02:39:53 +09:00
Hajime Hoshi
f72b8a4ced internal/ui: refactoring: remove redundant Monitor members 2023-09-24 01:58:07 +09:00
Hajime Hoshi
121d6005cd internal/ui: remove (*Monitor).Bounds
Updates #2780
2023-09-24 01:46:14 +09:00
Hajime Hoshi
69e3a2b974 internal/ui: refactoring: (*monitors).update must be called from the main thread
In the current implementation, (*monitors).update is not called
from other threads, but the current code is fragile.
2023-09-24 01:37:11 +09:00
Hajime Hoshi
b3058b68a0 ebiten: change the unit of (*Monitor).Bounds
Monitors can have different device scale factors, and in this case,
it doesn't make sense to use device-independent pixels as unit for
monitor positions and sizes.

Updates #2778
2023-09-23 17:58:23 +09:00
Hajime Hoshi
619436a47b internal/ui: refactoring: add monitor_glfw.go 2023-09-16 00:16:00 +09:00