-
Notifications
You must be signed in to change notification settings - Fork 903
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
Window starting position #806
Comments
A Currently we work around it by directly setting the position of the window with |
The big issue with |
This should work on all non-Wayland desktop platforms, so I'd be fine with this getting added. |
As the API was changed lately (commit) and there is only a Is that assumption correct? Another question: As by @Osspial's comment this doesn't work on a Wayland desktop - does or should |
Wayland apps cannot control their location on the desktop, at all. |
So should that be documented in |
It should be documented, because using winit should not require reading up on surprising implementation differences on different platforms. Everything that could cause someone to later open an issue along the lines of "why does xyz not work as expected?" should be explicitly documented. Assume someone primarily developed the app on one platform, then later decides to try running it on another. |
Usually better than documenting things is encoding it in the API. So if this doesn't work on Wayland, it just shouldn't be implemented for that platform. |
@chrisduerr The choice between x11 and wayland is done at runtime, so we cannot really do anything more than the method doing nothing on wayland, apart maybe returning an error? Though I tend to think it's the kind of functionality that would not really be a big issue if it just does not work on some platforms. |
Oh yeah, I always forget about the Wayland/X11 troubles where everything has to be done at runtime. I personally find it very difficult to have things only documented if there's an alternative, because often when using code completion or you're just skimming docs for specific methods you'll never find these limitations. When stuff then suddenly hard crashes on certain platforms that gets a bit problematic I think. If the method just does nothing, that's not a hard crash at least, but that might cause even more confusion when the issue is reported and it might take a lot longer until it is reported. Returning an error would at least directly encode the potential of runtime failure into the API, but obviously make the API inconvenient to use on other platforms. Ultimately I can't say what the best choice is in general and I think this has to be decided on a case by case basis, but it generally seems like something that goes against the grain of Rust, where most things are encoded into the compile time API checks. |
The best solution I can think of right now is to have EDIT: Really |
Speaking of |
I'd just like to say that extending the 0.20 scope further and further likely isn't a great idea. Though limiting the panics directly in winit feels like a good thing. |
How can we get the ball rolling on this? Would it be okay if I submitted a PR creating the public API, with an implementation on X11, and created a tracking issue for implementation on other platforms?
I think that, while returning |
Isn't this issue already fixed ? Window and WindowBuilder structs already have the corresponding function. |
I'm not sure about support of other platforms, but I believe at least XCB should support setting the starting position of a Window, so in theory it should be possible to have a
with_position
method on at least the X11 backend.Most of the other functions relevant at startup have a matching
with_*
function call for theirset_*
calls, so I'm not sure if this is due to a lack of support for some platforms, however it seems there are some clear advantages for the platforms that support it since it allows spawning the window without things jumping around.The text was updated successfully, but these errors were encountered: