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

Author Topic: Bug: no way to poll Alt+F4 event using sf::Style::None  (Read 4045 times)

0 Members and 2 Guests are viewing this topic.

Robert42

  • Newbie
  • *
  • Posts: 31
    • View Profile
Bug: no way to poll Alt+F4 event using sf::Style::None
« on: August 20, 2012, 11:18:55 pm »
Hi,

Alt+F4 behaves different, depending on the window-style:
  • sf::Style::Default You get a Close Event. fine.
  • sf::Style::Fullscreen You get a KeyPressed event. fine.
  • sf::Style::None You get neither a Close, nor a KeyPressed Event.

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
« Last Edit: August 21, 2012, 09:03:31 am by Robert42 »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Bug: no way to poll Alt+F4 event using sf::Style::None
« Reply #1 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.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Bug: no way to poll Alt+F4 event using sf::Style::None
« Reply #2 on: August 21, 2012, 09:38:13 am »
Quote
If you agree that's a bug
I do :)
Laurent Gomila - SFML developer

Robert42

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: Bug: no way to poll Alt+F4 event using sf::Style::None
« Reply #3 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
« Last Edit: August 21, 2012, 04:05:06 pm by Robert42 »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Bug: no way to poll Alt+F4 event using sf::Style::None
« Reply #4 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 :)
Laurent Gomila - SFML developer

Robert42

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: Bug: no way to poll Alt+F4 event using sf::Style::None
« Reply #5 on: August 21, 2012, 11:03:10 pm »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Bug: no way to poll Alt+F4 event using sf::Style::None
« Reply #6 on: August 22, 2012, 08:28:38 am »
Thanks!
Laurent Gomila - SFML developer

 

anything