Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Window creation (Linux)  (Read 6266 times)

0 Members and 1 Guest are viewing this topic.

Avency

  • Full Member
  • ***
  • Posts: 113
    • View Profile
Window creation (Linux)
« 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?

Avency

  • Full Member
  • ***
  • Posts: 113
    • View Profile
Window creation (Linux)
« Reply #1 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?

Lord Delvin

  • Jr. Member
  • **
  • Posts: 68
    • ICQ Messenger - 166781460
    • View Profile
Window creation (Linux)
« Reply #2 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Window creation (Linux)
« Reply #3 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 :)
Laurent Gomila - SFML developer

Aszarsha

  • Full Member
  • ***
  • Posts: 200
    • MSN Messenger - aszarsha@gmail.com
    • View Profile
Window creation (Linux)
« Reply #4 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. ;)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Window creation (Linux)
« Reply #5 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 :)
Laurent Gomila - SFML developer

Avency

  • Full Member
  • ***
  • Posts: 113
    • View Profile
Window creation (Linux)
« Reply #6 on: March 25, 2008, 11:21:54 am »
Glad to hear it. :D

Aszarsha

  • Full Member
  • ***
  • Posts: 200
    • MSN Messenger - aszarsha@gmail.com
    • View Profile
Window creation (Linux)
« Reply #7 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. :)

Avency

  • Full Member
  • ***
  • Posts: 113
    • View Profile
Window creation (Linux)
« Reply #8 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().

Redien

  • Newbie
  • *
  • Posts: 30
    • View Profile
Window creation (Linux)
« Reply #9 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.

Avency

  • Full Member
  • ***
  • Posts: 113
    • View Profile
Window creation (Linux)
« Reply #10 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Window creation (Linux)
« Reply #11 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.
Laurent Gomila - SFML developer

Avency

  • Full Member
  • ***
  • Posts: 113
    • View Profile
Window creation (Linux)
« Reply #12 on: March 26, 2008, 03:15:53 pm »
It worked. Everything is fine now. :D