Skip to content
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

Make window centered #438

Closed
Kagami opened this issue May 8, 2015 · 3 comments
Closed

Make window centered #438

Kagami opened this issue May 8, 2015 · 3 comments

Comments

@Kagami
Copy link

Kagami commented May 8, 2015

Would be nice to have ability to center window created by glutin. By default or with additional function call. Or at least to have ability to specify window's (x, y) position.

Seems like in OS X implementation windows are centered by default: https://github.com/tomaka/glutin/blob/119bd6393f5f3b8e1510ba6ab3281c8fb387449f/src/api/cocoa/mod.rs#L451

@Kagami
Copy link
Author

Kagami commented May 9, 2015

Oh, there is actually set_position function. Don't know how I was able to miss it.
So it's in fact possible to center the window with glutin, you just need to calculate the coords by yourself.

@fkaa
Copy link
Contributor

fkaa commented May 9, 2015

The documentation for NSWindow::center states:

The window is placed exactly in the center horizontally and somewhat above center vertically. Such a placement carries a certain visual immediacy and importance. [...]

You typically use this method to place a window—most likely an alert dialog—where the user can’t miss it. [...]

We should probably manually calculate the position to make it exact.

@tomaka
Copy link
Contributor

tomaka commented Nov 3, 2016

Closing for rust-windowing/winit#38

@tomaka tomaka closed this as completed Nov 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants