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

Author Topic: Window::SetSize(0, 0)  (Read 2986 times)

0 Members and 1 Guest are viewing this topic.

Robert42

  • Newbie
  • *
  • Posts: 31
    • View Profile
Window::SetSize(0, 0)
« on: August 29, 2011, 10:38:28 pm »
Hello Guys,

First: I am new to SFML and already love it! So I want to contribute with a small Feature-Request ;)

I had a small issue today. My Applicatio crashed with the message:
Code: [Select]
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  12 (X_ConfigureWindow)
  Value in failed request:  0x0
  Serial number of failed request:  64
  Current serial number in output stream:  64


After one hour work I figured out I accidentally called Widnow::SetSize with width==0 and height==0

It's no problem for me anymore, but for other new users it could be nice if some sort af error message (warning in console?) could telll them illegal size values has been used. Maybe we could use in Window.cpp something like this?
Code: [Select]
////////////////////////////////////////////////////////////
void Window::SetSize(unsigned int width, unsigned int height)
{
    if(width <= 0)
        Err() << "Window width must be > 0" << std::endl;

    if(height <= 0)
        Err() << "Window height must be > 0" << std::endl;

    if (myWindow)
        myWindow->SetSize(width, height);
}


PS: I could reproduce it on two different Linux-Computers (one with NVidia and one with Intel GPU) so I don't think this to be a problem of my drivers.

best regards,
Robert

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Window::SetSize(0, 0)
« Reply #1 on: August 29, 2011, 10:50:27 pm »
Hmm ok, not a major thing but you're right it's still better than the default XLib error :)
Laurent Gomila - SFML developer