SFML community forums

Help => Window => Topic started by: Avency on March 18, 2008, 04:21:50 pm

Title: Window creation (Linux)
Post by: Avency on March 18, 2008, 04:21:50 pm
Instead of starting centered, windows always appear in the upper left corner when running Metacity.
Compiz has a similar behavior, but you cannot predict in which corner windows are opened.
Is there any way to fix this?
Title: Window creation (Linux)
Post by: Avency on March 23, 2008, 04:18:20 pm
I've pulled down the latest fedora snapshot -> the problem still remains.

This is especially annoying in combination with sf::Style::None. Metacity displays the window in the top left corner, Compiz on the other hand handles sf::Style::None correctly (and centers the window).
To all other combinations the problems described earlier apply.
But you certainly want to disable Compiz when running an OpenGL application in windowed mode anyway.

Is there anyone using Linux who experiences the same problems or is it just me?
Title: Window creation (Linux)
Post by: Lord Delvin on March 23, 2008, 11:37:04 pm
Same problem on Ubuntu 7.10 64bit with SFML 1.1
I never noticed that but it seames as it has been there all the time.
Title: Window creation (Linux)
Post by: Laurent on March 24, 2008, 02:16:59 am
I guess it would be better if I added automatic centering of any window created with SFML :)
Title: Window creation (Linux)
Post by: Aszarsha on March 24, 2008, 03:32:57 am
Quote from: "Laurent"
I guess it would be better if I added automatic centering of any window created with SFML :)
Only if it's an option at window creation. ;)
Title: Window creation (Linux)
Post by: Laurent on March 24, 2008, 04:15:42 am
It's just to provide a consistent behaviour, then if you want to change the window position you can call Window::SetPosition.

I don't see any reason why someone would want to choose the default random behaviour over the consistent one.

And I really don't want to add more and more parameters to the window creation :)
Title: Window creation (Linux)
Post by: Avency on March 25, 2008, 11:21:54 am
Glad to hear it. :D
Title: Window creation (Linux)
Post by: Aszarsha on March 25, 2008, 05:10:12 pm
Quote from: "Laurent"
I don't see any reason why someone would want to choose the default random behaviour over the consistent one.
Because it is not random ! Many unix environment system (GNOME, KDE, XFCE at least, Compiz i think too) automatically create window at the position of the screen where there is actually less window opened (upper left by default, maybe) ; and i think this is a default behavior way better than centering ! ;)

In fact, the user should call Window::SetPosition if he want to center the window, not SFML. :)
Title: Window creation (Linux)
Post by: Avency on March 25, 2008, 05:33:52 pm
Quote from: "Aszarsha"
In fact, the user should call Window::SetPosition if he want to center the window, not SFML. :)

But then you would have to access the xdisplay settings which makes things non cross-platform.
Maybe the best solution would be something like sf::Window::Center().
Title: Window creation (Linux)
Post by: Redien on March 25, 2008, 10:58:21 pm
There is a routine for fetching the desktop resolution (sf::VideoMode::GetDesktopMode()).

But I agree with Aszarsha, it should be handled by the user not SFML, the default behavior of the OS should be preserved.

To make it more convenient there could be a sf::Style::Centered.
Title: Window creation (Linux)
Post by: Avency on March 26, 2008, 01:21:13 am
Quote from: "Redien"
There is a routine for fetching the desktop resolution (sf::VideoMode::GetDesktopMode()).

Going to check that out tomorrow, but it sounds like this is the solution.
Title: Window creation (Linux)
Post by: Laurent on March 26, 2008, 02:10:23 am
Yes, sf::VideoMode::GetDesktopMode() allows you to get the current desktop resolution :)

Quote
To make it more convenient there could be a sf::Style::Centered

Sounds like a good idea.
Title: Window creation (Linux)
Post by: Avency on March 26, 2008, 03:15:53 pm
It worked. Everything is fine now. :D