Search code examples
c++linuxubuntusfmlgnome-shell

SFML 1.6 Fullscreen Crash on Gnome 3


I'm trying to test using SFML's full screen mode, however it crashes every time the window enters full screen mode. Here's my program:

#include <stdio.h>
#include <SFML/Graphics.hpp>

int main ( int argc, char** argv ) {
    sf::Window win( sf::VideoMode ( argc >= 3 ? atoi ( ( const *char ) argv[1] ) : 1280, argc >= 3 ? atoi ( ( const *char ) argv[2] ) ), "", sf::Style::Fullscreen );

    while ( win.IsOpened ( ) ) {
        sf::Event in;

        while ( win.GetEvent ( in ) ) {
            if ( in.Type == sf::Event::KeyPressed ) {
                switch ( in.Key.Code ) {
                    case sf::Key::Q:
                        win.Close ( );
                        break;

                    default:
                        break;

                }
            }
        }

        win.Display ( );
    }
}

I compile it with a makefile with this command:

g++ -o build/Test -lsfml-system -lsfml-window -lsfml-graphics src/main.cpp

It crashes when I run the program from a terminal as such:

build/Test 1440 900

build/Test

I'm running ubuntu linux 12.04 on an Apple Macbook Air (4, 2). I tried using both gdm and lightdm, and they both had the same results. Additionally, it works fine with gnome 2, unity, and openbox, just not with gnome 3.

I don't mind having to mess around with config files, but I want to stay with gnome shell, because it is currently my favorite DE.


Solution

  • Switching to SFML 2.0 fixed the problem. Thank you to Konrad Rudolph for posting that in the comments.