SFML community forums

Help => Window => Topic started by: GabrielS on June 24, 2013, 10:17:17 pm

Title: Minimizing window - bug or me ?
Post by: GabrielS on June 24, 2013, 10:17:17 pm

I think I have found a bug due to Windows7 use (not sure if it's me or a bug, but i'm pretty sure this is a bug or something just different from windows 'minimize' function).
Here is my code :
    while (windowMain.isOpen())
                sf::Event event;
                while (windowMain.pollEvent(event))
                        switch (event.type)
                                case sf::Event::Closed: // closing using the cross button of the window
                                        windowMain.close(); // close the main window and gets out of this loop
                                case sf::Event::GainedFocus :
                                        if (minimized) // just to draw the window only when needed
                                        minimized = false;
                                case sf::Event::LostFocus :
                                        if (windowMain.getSize().y == 0)
                                                minimized = true;

The bug is : clicking on the minimize button then on the window to have it displayed works well, but using the little button in Windows7 called 'Show Desktop' that minimizes all the windows, doesn't.
I have no idea if this is a bug or just maybe something done different with the 'minimize button' of windows7 desktop, but I wanted to share this with you if you haven't seen this already ;)
I hope it can help/improve something (i don't know if I'm mistaking saying this is a bug, but it apparently looks like one).

EDIT : Also, clicking on the program task bar to minimize the program will minimize it, but restauring it will not display the window again. Is this because the size of the window is 0,0 when clicking on the minimize button & not 0,0 when reducing from the menu taskbar ?

Edit-EDIT : yes it's correct ! The size is not 0,0 when minimizing from Windows taskbar.
However, do you know how to get this event ?

Thanks if you have the solution for this ;)