Add monitor_from_point API#2649
Conversation
8fdb397 to
b790a56
Compare
kchibisov
left a comment
There was a problem hiding this comment.
I don't really like such an API, what's the use case for it? It seems like you wanted to pair it with the cursor position, but I think it's not a good thing to do.
What I'd suggest is to add current_monitor on the EventLoopWindowTarget, so you can get the currently focused monitor on the system, since that's all that matters and what you want anyway.
That way it'll work naturally with the rest of the MonitorHandle APIs. So for example on platforms when you don't know such a thing it'll return None, and given that most calls accept that None it could be used that way.
Most times, it will be paired with cursor_position but another use-case for tauri users, is to center the Window on a specific monitor, so the users provide the x,y and we use it to detect the nearest monitor and center the window on that monitor, but why isn't it a good thing?
Most cases yeah but there is a chance you may need other monitors. |
But you can least monitors and provide user to pick a monitor? Winit allows setting fullscreen on any monitor and you have them available on the event loop. |
by tauri users, I meant developers, not end-users. |
|
We had a little discussion regarding units across multiple monitors in #2645. Short version: I don't think using |
|
The thing is that coordinate space system is using could be negative, don't match, and so on. I think that there's no value in such API, given that we should use either The API with the points will be very limited and will add much complexity given that:
My main issue is that lack of use case for such an API, since if you want a current monitor, right now you pass |
I agree with that to an extent, the use case is very much rare so I don't really want to push hard on this since the functionality could be implemented in user code by iterating over the available monitors and comparing its bounds with the point. |
CHANGELOG.mdif knowledge of this change could be valuable to users