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

Author Topic: Window is automatically enlarged  (Read 1289 times)

0 Members and 1 Guest are viewing this topic.

Nightzus

  • Newbie
  • *
  • Posts: 6
    • View Profile
Window is automatically enlarged
« on: July 31, 2013, 01:52:25 am »
Hi guys !

I've been playing with SFML for a while and something is bothering me at the moment.

When I create a 800x600 window, no problem. But if I want a 1280x720 one, then the window is automatically maximized to take the largest possible screen portion. My resolution is 1360x760, and when I display the result of window.getSize(), I get 1360x732 or so, which corresponds to the maximum size given a rough 30 pixel title bar height.

I'd say the behaviour is like the window size was too large so that it automatically resizes it to fit the desktop resolution...

I'm running on Ubuntu 13.04 and using SFML 2.0. Maybe 2.1 fixed the problem, but I looked in the changelog and nothing pointed that out, but I may be missing something...

Do you have any clue on the issue ?

Thank you in advance !

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Window is automatically enlarged
« Reply #1 on: July 31, 2013, 07:49:09 am »
You should try SFML 2.1, there were a few changes related to windows sizes.

If it doesn't work, provide a complete and minimal example that reproduces the problem.
Laurent Gomila - SFML developer

Nightzus

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Window is automatically enlarged
« Reply #2 on: July 31, 2013, 11:55:39 am »
I have just installed SFML 2.1, and it did not work.

I tried the most minimalist example, just displaying a window, and the same bug appeared. But after a few tests and after playing with displaying the size on a Event::Resized, I think I know where it comes from and SFML is probably not the problem !

I am using Gnome 3 as Desktop Manager, and I have been toying with extensions. One of them removes the black top bar and lets it reappear when the cursor goes on top. After disabling it, it became clear : the top bar is approximately 30px as well as title bars of windows. So it is about 60 extra pixels. Given that I want a drawable window height of 720 and that I have at most 768 due to my resolution, I only get 708 of drawable height. I suppose SFML, in this case, decides to resize the window in order to fit the available height (and not keeping the ratio, but this is not the problem) and the available width as well.
So maybe the tweak that I am using to remove the top bar is not a) well implemented b) not supported by SFML, so that SFML "thinks" that only 708 pixels are available and decides to resize.

The last thing I do not understand is why then when it takes the decision to resize, the height occupies the whole height - that is the space normally taken by top bar. It is like it thinks that the top bar is there, so decides to resize, and at the resize no longer thinks the top bar is displayed...

But now that I understood what was going wrong, I'll try to figure a software solution out :)
« Last Edit: July 31, 2013, 11:58:04 am by Nightzus »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Window is automatically enlarged
« Reply #3 on: July 31, 2013, 12:08:39 pm »
SFML never decides to resize the window automatically, whatever happens is caused by the WM.
Laurent Gomila - SFML developer

Nightzus

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Window is automatically enlarged
« Reply #4 on: July 31, 2013, 01:03:41 pm »
Ok, so this is clearly due to this extension thing.

Thank you for your answers ;)