Skip to content

Commit

Permalink
[linux] Issue #318 - fix compile on Linux with older SFML versions
Browse files Browse the repository at this point in the history
  • Loading branch information
mickelson committed Mar 2, 2017
1 parent 6c2c13d commit b2b4233
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/fe_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
#include <cassert>
#endif

#define FE_VERSION_INT( a, b, c ) ((a)<<16 | (b)<<8 | (c))
#define SFML_VERSION_INT FE_VERSION_INT( SFML_VERSION_MAJOR, SFML_VERSION_MINOR, SFML_VERSION_PATCH )

extern const char *FE_WHITESPACE;

//
Expand Down
7 changes: 7 additions & 0 deletions src/fe_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,15 @@ void launch_callback( void *o )
// when the emulator is done).
//
sf::sleep( sf::milliseconds( 1000 ) );

// hasFocus() is only available as of SFML 2.2.
#if ( SFML_VERSION_INT >= FE_VERSION_INT( 2, 2, 0 ))
if ( win->hasFocus() )
win->close();
#else
win->close();
#endif

#else
win->close(); // this fixes raspi version (w/sfml-pi) obscuring daphne (and others?)
#endif
Expand Down

0 comments on commit b2b4233

Please sign in to comment.