SFML community forums

Help => Window => Topic started by: Robert42 on August 20, 2012, 11:18:55 pm

Title: Bug: no way to poll Alt+F4 event using sf::Style::None
Post by: Robert42 on August 20, 2012, 11:18:55 pm
Hi,

Alt+F4 behaves different, depending on the window-style:

Tested using SFML 2.0 fetched and built today.

If you agree that's a bug, I can create a pull-request if you want

greetings, Robert

Edit: I am using LinuxMint 13 x64
Title: Re: Bug: no way to poll Alt+F4 event using sf::Style::None
Post by: Nexus on August 21, 2012, 09:09:04 am
Is it really fine that you get different types of events in fullscreen and windowed mode? I wouldn't expect that.
Title: Re: Bug: no way to poll Alt+F4 event using sf::Style::None
Post by: Laurent on August 21, 2012, 09:38:13 am
Quote
If you agree that's a bug
I do :)
Title: Re: Bug: no way to poll Alt+F4 event using sf::Style::None
Post by: Robert42 on August 21, 2012, 03:43:45 pm
Wow Xlib is uglier and it's documentation harder to find than I expected. (Actually I couldn't find any X11 Documentation regarding MOTIF_WM_HINTS)

The only working thing I could figure out is to get Alt+F4 beeing triggered a Close event. I couldn't find a way to get an Alt+F4 keyevent triggered in window mode.

My workaround was to use
            if (style & Style::Close)
            {
                hints.Decorations |= 0;
                hints.Functions   |= MWM_FUNC_CLOSE;
            }
            if (style==0)
            {
                hints.Decorations |= 0;
                hints.Functions   |= MWM_FUNC_CLOSE;
            }
 
instead of
            if (style & Style::Close)
            {
                hints.Decorations |= 0;
                hints.Functions   |= MWM_FUNC_CLOSE;
            }
 
Which is far to hacky for a pull request.

Sorry that I couldn't contribute more  :(
greetings, Robert
Title: Re: Bug: no way to poll Alt+F4 event using sf::Style::None
Post by: Laurent on August 21, 2012, 08:47:06 pm
Quote
Sorry that I couldn't contribute more
Don't worry, XLib is such an undocumented mess to work with... I plan to replace it with XCB soon.

You can open an issue on the tracker, so that this bug doesn't get lost in the forum :)
Title: Re: Bug: no way to poll Alt+F4 event using sf::Style::None
Post by: Robert42 on August 21, 2012, 11:03:10 pm
Issue created: https://github.com/SFML/SFML/issues/274
Title: Re: Bug: no way to poll Alt+F4 event using sf::Style::None
Post by: Laurent on August 22, 2012, 08:28:38 am
Thanks!